MCPcopy Create free account
hub / github.com/EasyIME/PIME / TestTCPServer

Class TestTCPServer

python/python3/tornado/test/tcpclient_test.py:41–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40
41class TestTCPServer(TCPServer):
42 def __init__(self, family):
43 super().__init__()
44 self.streams = [] # type: List[IOStream]
45 self.queue = Queue() # type: Queue[IOStream]
46 sockets = bind_sockets(0, "localhost", family)
47 self.add_sockets(sockets)
48 self.port = sockets[0].getsockname()[1]
49
50 def handle_stream(self, stream, address):
51 self.streams.append(stream)
52 self.queue.put(stream)
53
54 def stop(self):
55 super().stop()
56 for stream in self.streams:
57 stream.close()
58
59
60class TCPClientTest(AsyncTestCase):

Callers 1

start_serverMethod · 0.85

Calls

no outgoing calls

Tested by 1

start_serverMethod · 0.68