mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8373807: test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java getURI() uses "localhost"
Reviewed-by: jpai
This commit is contained in:
parent
4e05748f08
commit
f3a48560b5
@ -351,7 +351,14 @@ public class DummyWebSocketServer implements Closeable {
|
||||
if (!started.get()) {
|
||||
throw new IllegalStateException("Not yet started");
|
||||
}
|
||||
return URI.create("ws://localhost:" + address.getPort());
|
||||
String ip = address.getAddress().isAnyLocalAddress()
|
||||
? InetAddress.getLoopbackAddress().getHostAddress()
|
||||
: address.getAddress().getHostAddress();
|
||||
if (ip.indexOf(':') >= 0) {
|
||||
ip = String.format("[%s]", ip);
|
||||
}
|
||||
|
||||
return URI.create("ws://" + ip + ":" + address.getPort());
|
||||
}
|
||||
|
||||
private boolean readRequest(SocketChannel channel, StringBuilder request)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user