async def test_close_closes_active_connections(self): connector = self.new_connector() address = aioppspp.connection.Address('0.0.0.0', 0) connections = [] for _ in range(3): connection = await connector.connect(address) connection.protocol.connection_made(unittest.mock.Mock()) connections.append(connection) connector.close() for connection in connections: self.assertTrue(connection.closed)
async def test_release(self): connector = self.new_connector() address = aioppspp.connection.Address('0.0.0.0', 0) connection0 = await connector.connect(address) connection1 = await connector.connect(address) connection0.protocol.connection_made(unittest.mock.Mock()) connection1.protocol.connection_made(unittest.mock.Mock()) connection0.release() connection1.release() await connector.connect(address) await connector.connect(address) connector.close()
def test_release_connection_while_closed(self): connector = self.new_connector() connector.close() connector.release_connection(...)
async def test_close_connection_when_closed(self): connector = self.new_connector() address = aioppspp.connection.Address('0.0.0.0', 0) connection = await connector.connect(address) connector.close() connector.close_connection(connection)
def test_close_closed_connector(self): connector = self.new_connector() connector.close() connector.close()
def test_close(self): connector = self.new_connector() connector.close() self.assertTrue(connector.closed)