RFR: 8208693: HttpClient: Extend the request timeout's scope to cover the response body [v10]

Daniel Fuchs dfuchs at openjdk.org
Thu Nov 6 15:57:02 UTC 2025


On Thu, 6 Nov 2025 13:15:59 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/websocket/WebSocketTest.java line 172:
>> 
>>> 170:                         .newWebSocketBuilder()
>>> 171:                         .buildAsync(server.getURI(), webSocketListener)
>>> 172:                         .join();
>> 
>> Shouldn't you add a `connectTimeout` to the web socket builder? Otherwise of course you won't find any :-)
>
> I was naively expecting `WebSocket.Builder` to inherit `connectTimeout` from the parent `HttpClient`, I was indeed mistaken. Corrected it in c3210d88d0c.

Well the connect timeout if set in the client *is* inherited, but it only concerns TCP/TLS and stops after the SSL handshake.
The WebSocket connect timeout additionally covers the WebSocket handshake - and stops when the 101 response is received.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27469#discussion_r2499601626


More information about the net-dev mailing list