def tearDown(self):
        try:
            self.proxyServerFactory.protoInstance.transport.loseConnection()
        except __HOLE__:
            pass
        try:
            pi = self.proxyServerFactory.clientFactoryInstance.protoInstance
            pi.transport.loseConnection()
        except AttributeError:
            pass
        try:
            self.clientProtocol.transport.loseConnection()
        except AttributeError:
            pass
        try:
            self.serverProtocol.transport.loseConnection()
        except AttributeError:
            pass
        return defer.gatherResults(
            [defer.maybeDeferred(p.stopListening) for p in self.openPorts])
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/test/test_protocols.py/Portforwarding.tearDown