(self, monkeypatch: pytest.MonkeyPatch)
| 384 | pm.request("GET", "http://example.com", retries=False) |
| 385 | |
| 386 | def test_proxy_rejection(self, monkeypatch: pytest.MonkeyPatch) -> None: |
| 387 | _set_up_fake_getaddrinfo(monkeypatch) |
| 388 | evt = threading.Event() |
| 389 | |
| 390 | def request_handler(listener: socket.socket) -> None: |
| 391 | sock = listener.accept()[0] |
| 392 | |
| 393 | handler = handle_socks5_negotiation(sock, negotiate=False) |
| 394 | addr, port = next(handler) |
| 395 | with pytest.raises(StopIteration): |
| 396 | handler.send(False) |
| 397 | |
| 398 | evt.wait() |
| 399 | sock.close() |
| 400 | |
| 401 | self._start_server(request_handler) |
| 402 | proxy_url = f"socks5h://{self.host}:{self.port}" |
| 403 | with socks.SOCKSProxyManager(proxy_url) as pm: |
| 404 | with pytest.raises(NewConnectionError): |
| 405 | pm.request("GET", "http://example.com", retries=False) |
| 406 | evt.set() |
| 407 | |
| 408 | def test_socks_with_password(self) -> None: |
| 409 | def request_handler(listener: socket.socket) -> None: |
nothing calls this directly
no test coverage detected