TextFormatter { public static StringBuilder socketAddress(@Nullable SocketAddress addr) { final StringBuilder buf = new StringBuilder(32); appendSocketAddress(buf, addr); return buf; } private  TextFormatter(); static StringBuilder elapsed(long elapsedNanos); static StringBuilder elapsed(long startTimeNanos, long endTimeNanos); static void appendElapsed(StringBuilder buf, long elapsedNanos); static void appendElapsed(StringBuilder buf, long startTimeNanos, long endTimeNanos); static StringBuilder size(long size); static void appendSize(StringBuilder buf, long size); static StringBuilder elapsedAndSize(long startTimeNanos, long endTimeNanos, long size); static void appendElapsedAndSize(
            StringBuilder buf, long startTimeNanos, long endTimeNanos, long size); static StringBuilder epochMillis(long timeMillis); static void appendEpochMillis(StringBuilder buf, long timeMillis); static StringBuilder epochMicros(long timeMicros); static void appendEpochMicros(StringBuilder buf, long timeMicros); static StringBuilder socketAddress(@Nullable SocketAddress addr); static void appendSocketAddress(StringBuilder buf, @Nullable SocketAddress addr); static StringBuilder inetAddress(@Nullable InetAddress addr); static void appendInetAddress(StringBuilder buf, @Nullable InetAddress addr);  }
@Test void socketAddress() throws Exception { assertThat(TextFormatter.socketAddress(null) .toString()).isEqualTo("null"); assertThat(TextFormatter.socketAddress(new DomainSocketAddress("/foo")) .toString()).isEqualTo("/foo"); assertThat(TextFormatter.socketAddress(new InetSocketAddress("127.0.0.1", 80)) .toString()).isEqualTo("127.0.0.1:80"); assertThat(TextFormatter.socketAddress(new InetSocketAddress("repo.maven.apache.org", 80)) .toString()).matches("^repo\\.maven\\.apache\\.org/.+:80$"); assertThat(TextFormatter.socketAddress(InetSocketAddress.createUnresolved("foo.com", 443)) .toString()).isEqualTo("foo.com:443"); assertThat(TextFormatter.socketAddress(new InetSocketAddress(InetAddress.getByAddress( "bar.com", new byte[] { 1, 2, 3, 4 }), 8080)).toString()).isEqualTo("bar.com/1.2.3.4:8080"); }