'C{writeSequence} pauses its producer if too much data is buffered only
if this is a streaming producer.'

def test_nonStreamingProducer(self):

    test = self
    @implementer(IPullProducer)
    class SaveActionProducer(object, ):
        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
        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)
    self.assertEqual(producer.actions, ['resume', 'resume'])
