eolivelli commented on code in PR #1868: URL: https://github.com/apache/zookeeper/pull/1868#discussion_r902422150
########## zookeeper-server/src/main/java/org/apache/zookeeper/server/embedded/ZooKeeperServerEmbeddedImpl.java: ########## @@ -184,22 +192,22 @@ public void run() { @Override public String getConnectionString() { - if (config.getClientPortAddress() != null) { - String raw = config.getClientPortAddress().getHostString() + ":" + config.getClientPortAddress().getPort(); - return raw.replace("0.0.0.0", "localhost"); - } else { - throw new IllegalStateException("No client address is configured"); - } + return prettifyConnectionString(config.getClientPortAddress(), boundClientPort); } @Override public String getSecureConnectionString() { - if (config.getSecureClientPortAddress() != null) { - String raw = config.getSecureClientPortAddress().getHostString() + ":" + config.getSecureClientPortAddress().getPort(); - return raw.replace("0.0.0.0", "localhost"); - } else { - throw new IllegalStateException("No client address is configured"); + return prettifyConnectionString(config.getSecureClientPortAddress(), boundSecureClientPort); + } + + private String prettifyConnectionString(InetSocketAddress confAddress, int boundPort) { Review Comment: nit: static ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org