JDK 25 HttpClient Does Not Use SOCKS ProxySelector Routes
Choose a Java HTTP transport that actually supports SOCKS instead of relying solely on the type returned by a ProxySelector.
A Java proxy object describes a route. The networking client still decides which kinds of route it can use. This matters when the available endpoint speaks SOCKS and the application uses java.net.http.HttpClient.
In the JDK 25 implementation examined here, the HTTP client's request code accepts an HTTP candidate from the selector. A SOCKS candidate does not cause it to perform SOCKS negotiation; the implementation can continue without a proxy. A successful response is therefore insufficient evidence that a custom selector's SOCKS entry was used.
Choose the transport first
For an existing URLConnection-based application, the protocol handler can be given a supported explicit proxy when opening the connection:
Proxy route = new Proxy(Proxy.Type.SOCKS,
new InetSocketAddress("proxy.example", 1080));
URLConnection connection = URI.create("https://service.example/")
.toURL().openConnection(route);
connection.setConnectTimeout(5000);
connection.setReadTimeout(15000);
For permitted public-target tests, use a matching SOCKS endpoint from your service or the SOCKS proxy list. This is a different client API, not an alternative spelling of HttpClient.Builder.proxy. Preserve the destination URL so HTTPS continues to identify the intended website.
An application that must retain java.net.http can instead use a compatible HTTP proxy endpoint, including an approved adapter that handles the onward SOCKS connection. That adds a real component and another access boundary; changing port 8080 to 1080 does not provide the translation.
Keep selection and adoption visible
Record both the selector's result and the connection the client actually opens. The first describes policy output; the second establishes whether the implementation adopted it.
Bind conclusions to the runtime and transport in use. JVM SOCKS properties used by one socket implementation are not a promise that every HTTP library consults them. When the route is compulsory, an unsupported proxy type should be detected before accepting an apparently successful direct request.