def test_nonStreamingProducer(self):
        test = self

        class SaveActionProducer(object):
            implements(IPullProducer)
            client = None

            def __init__(self):
                self.actions = []

            def resumeProducing(self):
                self.actions.append("resume")
                if self.actions.count("resume") == 2:
                    self.client.transport.stopConsuming()
                else:
                    test.setWriteBufferSize(self.client.transport, 500)
                    self.client.transport.writeSequence(["x" * 50] * 20)

            def stopProducing(self):
                self.actions.append("stop")


        producer = SaveActionProducer()

        def connected(protocols):
            client = protocols[0]
            producer.client = client
            # Register a non-streaming producer and verify that it is resumed
            # immediately.
            client.transport.registerProducer(producer, False)
            self.assertEqual(producer.actions, ["resume"])

        reactor = self.buildReactor()
        d = self.getConnectedClientAndServer(reactor, "127.0.0.1",
                                             socket.AF_INET)
        d.addCallback(connected)
        d.addErrback(log.err)
        self.runReactor(reactor)
        # After the local send buffer empties out, the producer should be
        # resumed again.
        self.assertEqual(producer.actions, ["resume", "resume"])
The C{closed} attribute should reflect whether C{close()} has been
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/test/test_tcp.py/WriteSequenceTestsMixin.test_nonStreamingProducer--crossover with--dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/test/test_zipstream.py/FileEntryMixin.test_closed