Skip to content

Commit 3480c05

Browse files
committed
Do not use InetSocketAddress.createUnresolved for uris already containing an IP address
1 parent f38d0a8 commit 3480c05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/io/nats/client/impl/SocketDataPort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void connect(NatsConnection conn, NatsUri nuri, long timeoutNanos) throws
7474
socket.setTcpNoDelay(true);
7575
socket.setReceiveBufferSize(2 * 1024 * 1024);
7676
socket.setSendBufferSize(2 * 1024 * 1024);
77-
InetSocketAddress inetSocketAddress = options.isNoResolveHostnames() ?
77+
InetSocketAddress inetSocketAddress = (options.isNoResolveHostnames() && !nuri.hostIsIpAddress()) ?
7878
InetSocketAddress.createUnresolved(host, port) : new InetSocketAddress(host, port);
7979
socket.connect(inetSocketAddress, (int) timeout);
8080

0 commit comments

Comments
 (0)