def test_loseConnectionNotProxying(self):
        """
        L{TransportProxyProducer.loseConnection} does nothing when the
        proxy is not active.
        """
        transport = StringTransportWithDisconnection()
        protocol = AccumulatingProtocol()
        protocol.makeConnection(transport)
        transport.protocol = protocol
        proxy = TransportProxyProducer(transport)
        proxy.stopProxying()
        self.assertTrue(transport.connected)

        proxy.loseConnection()

        # The transport is not touched, when not proxying.
        self.assertTrue(transport.connected)

        L{TransportProxyProducer.loseConnection} does nothing when the
        proxy is not active.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_newclient.py