RFR: 8373807: test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java getURI() uses "localhost"

Jaikiran Pai jpai at openjdk.org
Wed Dec 17 10:58:08 UTC 2025


On Wed, 17 Dec 2025 10:32:56 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> The WebSockteTest was observed failing in timeout once, waiting for the completable future returned by `WebSocketBuilder::build` to complete. The suspicion is that it may have been caused by the request being misdirected due to the use of "localhost" in the URI. 
> 
> This trivial fix ensures that the DumyWebSocketServer::getURI returns a URI with a literal IP address instead of relying on "localhost".

test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java line 356:

> 354:         String ip = address.getAddress().isAnyLocalAddress()
> 355:                 ? InetAddress.getLoopbackAddress().getHostAddress()
> 356:                 : address.getAddress().getHostAddress();

Hello Daniel, this looks OK to me. But given that we always use loopback address to bind the ServerSocketChannel in this test (line 333), can we just use loopback address here too?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28864#discussion_r2626578735


More information about the net-dev mailing list