diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java index 6ae18724166f6..e79bacb4156b2 100644 --- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java +++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java @@ -210,7 +210,7 @@ public void failure(Throwable failure) { private URI replaceWithNew(InetSocketAddress address, URI uri) { String originalUri = uri.toString(); String newUri = (originalUri.split(":")[0] + "://") - + address.getHostName() + ":" + + address.getHostString() + ":" + address.getPort() + uri.getRawPath(); if (uri.getRawQuery() != null) { diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java index da522020f5129..5e0a592cdc60b 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java @@ -274,7 +274,7 @@ private CompletableFuture createConnection(InetSocketAddress logicalA cnx.setTargetBroker(logicalAddress); } - cnx.setRemoteHostName(physicalAddress.getHostName()); + cnx.setRemoteHostName(physicalAddress.getHostString()); cnx.connectionFuture().thenRun(() -> { if (log.isDebugEnabled()) { diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarServiceNameResolver.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarServiceNameResolver.java index 35c04ce27b192..32f5aa4975c6c 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarServiceNameResolver.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarServiceNameResolver.java @@ -61,7 +61,7 @@ public InetSocketAddress resolveHost() { @Override public URI resolveHostUri() { InetSocketAddress host = resolveHost(); - String hostUrl = serviceUri.getServiceScheme() + "://" + host.getHostName() + ":" + host.getPort(); + String hostUrl = serviceUri.getServiceScheme() + "://" + host.getHostString() + ":" + host.getPort(); return URI.create(hostUrl); }