def test_streamingProducerTwice(self):
        """
        Registering a streaming producer twice throws an exception.
        """
        clientProtocol, tlsProtocol, producer = self.setupStreamingProducer()
        originalProducer = tlsProtocol._producer
        producer2 = object()
        self.assertRaises(RuntimeError,
            clientProtocol.transport.registerProducer, producer2, True)
        self.assertIs(tlsProtocol._producer, originalProducer)

        Registering a streaming producer twice throws an exception.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/test/test_tls.py