MCPcopy
hub / github.com/urllib3/urllib3 / test_connection_failure

Method test_connection_failure

test/contrib/test_socks.py:372–384  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

370 pm.request("GET", "http://example.com", retries=False)
371
372 def test_connection_failure(self) -> None:
373 event = threading.Event()
374
375 def request_handler(listener: socket.socket) -> None:
376 listener.close()
377 event.set()
378
379 self._start_server(request_handler)
380 proxy_url = f"socks5h://{self.host}:{self.port}"
381 with socks.SOCKSProxyManager(proxy_url) as pm:
382 event.wait()
383 with pytest.raises(NewConnectionError):
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)

Callers

nothing calls this directly

Calls 2

_start_serverMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected