public static void appendSocketAddress(StringBuilder buf, @Nullable SocketAddress addr) {
        if (!(addr instanceof InetSocketAddress) || addr instanceof DomainSocketAddress) {
            buf.append(addr);
            return;
        }

        final InetSocketAddress isa = (InetSocketAddress) addr;
        final String host = isa.getHostString();
        final InetAddress resolvedAddr = isa.getAddress();
        final String ip = resolvedAddr != null ? resolvedAddr.getHostAddress() : null;
        if (host != null) {
            if (ip != null) {
                if (host.equals(ip)) {
                    buf.append(ip);
                } else {
                    buf.append(host).append('/').append(ip);
                }
            } else {
                buf.append(host);
            }
        } else {
            buf.append(ip);
        }
        buf.append(':').append(isa.getPort());
    }
Formats the given {@link SocketAddress}. The difference from {@link InetSocketAddress#toString()} is
that it does not format a host name if it's not available or it's same with the IP address.
core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java