We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5964a12 commit 08215aeCopy full SHA for 08215ae
test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java
@@ -351,7 +351,14 @@ URI getURI() {
351
if (!started.get()) {
352
throw new IllegalStateException("Not yet started");
353
}
354
- return URI.create("ws://localhost:" + address.getPort());
+ String ip = address.getAddress().isAnyLocalAddress()
355
+ ? InetAddress.getLoopbackAddress().getHostAddress()
356
+ : address.getAddress().getHostAddress();
357
+ if (ip.indexOf(':') >= 0) {
358
+ ip = String.format("[%s]", ip);
359
+ }
360
+
361
+ return URI.create("ws://" + ip + ":" + address.getPort());
362
363
364
private boolean readRequest(SocketChannel channel, StringBuilder request)
0 commit comments