Beispiel #1
0
 def test_protocolToConsumer(self):
     """
     L{IProtocol} providers can be adapted to L{IConsumer} providers using
     L{ProtocolToConsumerAdapter}.
     """
     result = []
     p = Protocol()
     p.dataReceived = result.append
     consumer = IConsumer(p)
     consumer.write(b"hello")
     self.assertEqual(result, [b"hello"])
     self.assertIsInstance(consumer, ProtocolToConsumerAdapter)
 def test_protocolToConsumer(self):
     """
     L{IProtocol} providers can be adapted to L{IConsumer} providers using
     L{ProtocolToConsumerAdapter}.
     """
     result = []
     p = Protocol()
     p.dataReceived = result.append
     consumer = IConsumer(p)
     consumer.write(b"hello")
     self.assertEqual(result, [b"hello"])
     self.assertIsInstance(consumer, ProtocolToConsumerAdapter)
Beispiel #3
0
 def startProducing(self, consumer: IConsumer) -> Deferred:
     consumer.write(self._data)
     return succeed(None)