def tearDown(self): if self.serverProto.transport is not None: self.serverProto.transport.loseConnection() if self.clientProto.transport is not None: self.clientProto.transport.loseConnection() return waitUntilAllDisconnected(reactor, [self.serverProto, self.clientProto])
def tearDown(self): if self.serverProto.transport is not None: self.serverProto.transport.loseConnection() if self.clientProto.transport is not None: self.clientProto.transport.loseConnection() return waitUntilAllDisconnected( reactor, [self.serverProto, self.clientProto])
def tearDown(self): """ Clean up any server connections associated with the L{DNSServerFactory} created in L{setUp} """ # It'd be great if DNSServerFactory had a method that # encapsulated this task. At least the necessary data is # available, though. for conn in self.factory.connections[:]: conn.transport.loseConnection() return waitUntilAllDisconnected(reactor, self.factory.connections[:])
def tearDown(self): """ Clean up any server connections associated with the L{DNSServerFactory} created in L{setUp} """ # It'd be great if DNSServerFactory had a method that # encapsulated this task. At least the necessary data is # available, though. for conn in self.factory.connections[:]: conn.transport.loseConnection() return waitUntilAllDisconnected(reactor, self.factory.connections[:])
def tearDown(self): if self.agent: # clean up connections for twisted.web.client.Agent test. self.agent.closeCachedConnections() self.agent = None # If the test indicated it might leave some server-side connections # around, clean them up. connections = list(self.wrapper.protocols.keys()) # If there are fewer server-side connections than requested, # that's okay. Some might have noticed that the client closed # the connection and cleaned up after themselves. for n in range(min(len(connections), self.cleanupServerConnections)): proto = connections.pop() msg("Closing %r" % (proto,)) proto.transport.loseConnection() d = self.port.stopListening() return defer.DeferredList([waitUntilAllDisconnected( reactor, list(self.wrapper.protocols.keys())), d])