def test_bufferEarlyData(self):
        bytes = []
        class ListConsumer(Protocol):
            def dataReceived(self, data):
                bytes.append(data)

        protocol = ListConsumer()
        response = justTransportResponse(StringTransport())
        response._bodyDataReceived('foo')
        response._bodyDataReceived('bar')
        response.deliverBody(protocol)
        response._bodyDataReceived('baz')
        self.assertEqual(bytes, ['foo', 'bar', 'baz'])
        # Make sure the implementation-detail-byte-buffer is cleared because
        # not clearing it wastes memory.
        self.assertIdentical(response._bodyBuffer, None)
If data is delivered to the L{Response} before a protocol is registered
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/web/test/test_newclient.py/ResponseTests.test_bufferEarlyData