| 292 | |
| 293 | |
| 294 | async def test_tcp_start_error(): |
| 295 | manager = MagicMock() |
| 296 | |
| 297 | server = await asyncio.start_server( |
| 298 | MagicMock(), host="127.0.0.1", port=0, reuse_address=False |
| 299 | ) |
| 300 | port = server.sockets[0].getsockname()[1] |
| 301 | |
| 302 | with taddons.context() as tctx: |
| 303 | inst = ServerInstance.make(f"regular@127.0.0.1:{port}", manager) |
| 304 | with pytest.raises( |
| 305 | OSError, match=f"proxy failed to listen on 127\\.0\\.0\\.1:{port}" |
| 306 | ): |
| 307 | await inst.start() |
| 308 | tctx.options.listen_host = "127.0.0.1" |
| 309 | tctx.options.listen_port = port |
| 310 | inst3 = ServerInstance.make(f"regular", manager) |
| 311 | with pytest.raises(OSError): |
| 312 | await inst3.start() |
| 313 | |
| 314 | |
| 315 | async def test_invalid_protocol(monkeypatch): |