MCPcopy Index your code
hub / github.com/python/cpython / test_server_close

Method test_server_close

Lib/test/test_asyncio/test_events.py:1399–1415  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1397
1398 @socket_helper.skip_if_tcp_blackhole
1399 def test_server_close(self):
1400 f = self.loop.create_server(MyProto, '0.0.0.0', 0)
1401 server = self.loop.run_until_complete(f)
1402 sock = server.sockets[0]
1403 host, port = sock.getsockname()
1404
1405 client = socket.socket()
1406 client.connect(('127.0.0.1', port))
1407 client.send(b'xxx')
1408 client.close()
1409
1410 server.close()
1411
1412 client = socket.socket()
1413 self.assertRaises(
1414 ConnectionRefusedError, client.connect, ('127.0.0.1', port))
1415 client.close()
1416
1417 def _test_create_datagram_endpoint(self, local_addr, family):
1418 class TestMyDatagramProto(MyDatagramProto):

Callers

nothing calls this directly

Calls 8

socketMethod · 0.80
create_serverMethod · 0.45
run_until_completeMethod · 0.45
getsocknameMethod · 0.45
connectMethod · 0.45
sendMethod · 0.45
closeMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected