def test_path_full_lite(self, initiator_key, server, client_factory):
"""
Add 253 fake responders to a path. Then, add a 254th responder
and check that the correct error code (Path Full) is being
returned.
"""
assert len(server.protocols) == 0
# Get path instance of server
path = server.paths.get(initiator_key.pk)
# Add fake clients to path
clients = [_FakePathClient() for _ in range(0x02, 0x100)]
for client in clients:
path.add_responder(client)
# Now the path is full
with pytest.raises(websockets.ConnectionClosed) as exc_info:
yield from client_factory(responder_handshake=True)
assert exc_info.value.code == CloseCode.path_full_error
# Remove fake clients from path
for client in clients:
path.remove_client(client)
yield from server.wait_connections_closed()
评论列表
文章目录