def test_loseConnectionWhileProxying(self):
        """
        L{TransportProxyProducer.loseConnection} calls the wrapped transport's
        C{loseConnection}.
        """
        transport = StringTransportWithDisconnection()
        protocol = AccumulatingProtocol()
        protocol.makeConnection(transport)
        transport.protocol = protocol
        proxy = TransportProxyProducer(transport)
        # Transport is connected and production.
        self.assertTrue(transport.connected)
        self.assertEqual(transport.producerState, u'producing')

        proxy.loseConnection()

        # The transport is not explicitly stopped, but requested to
        # disconnect.
        self.assertEqual(transport.producerState, u'producing')
        self.assertFalse(transport.connected)

        L{TransportProxyProducer.loseConnection} calls the wrapped transport's
        C{loseConnection}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_newclient.py