MCPcopy Create free account
hub / github.com/python-websockets/websockets / test_existing_socket

Method test_existing_socket

tests/asyncio/test_server.py:64–70  ·  view source on GitHub ↗

Server receives connection using a pre-existing socket.

(self)

Source from the content-addressed store, hash-verified

62 )
63
64 async def test_existing_socket(self):
65 """Server receives connection using a pre-existing socket."""
66 with socket.create_server(("localhost", 0)) as sock:
67 host, port = sock.getsockname()
68 async with serve(handler, sock=sock):
69 async with connect(f"ws://{host}:{port}/") as client:
70 await self.assertEval(client, "ws.protocol.state.name", "OPEN")
71
72 async def test_select_subprotocol(self):
73 """Server selects a subprotocol with the select_subprotocol callable."""

Callers

nothing calls this directly

Calls 3

connectFunction · 0.90
serveFunction · 0.50
assertEvalMethod · 0.45

Tested by

no test coverage detected