@Test public void testAddressAsString() { assertEquals("127.0.0.1:9003", asString(new InetSocketAddress("localhost", 9003))); assertEquals("5.5.5.5:9003", asString(new InetSocketAddress("5.5.5.5", 9003))); }
public static String asString(SocketAddress socketAddress) { final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; final InetAddress inetAddress = inetSocketAddress.getAddress(); String host = inetSocketAddress.getHostName(); if (inetAddress != null) { host = inetAddress.getHostAddress(); } return host + ":" + inetSocketAddress.getPort(); }
InetSocketAddressUtils { public static String asString(SocketAddress socketAddress) { final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; final InetAddress inetAddress = inetSocketAddress.getAddress(); String host = inetSocketAddress.getHostName(); if (inetAddress != null) { host = inetAddress.getHostAddress(); } return host + ":" + inetSocketAddress.getPort(); } }
InetSocketAddressUtils { public static String asString(SocketAddress socketAddress) { final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; final InetAddress inetAddress = inetSocketAddress.getAddress(); String host = inetSocketAddress.getHostName(); if (inetAddress != null) { host = inetAddress.getHostAddress(); } return host + ":" + inetSocketAddress.getPort(); } private  InetSocketAddressUtils(); }
InetSocketAddressUtils { public static String asString(SocketAddress socketAddress) { final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; final InetAddress inetAddress = inetSocketAddress.getAddress(); String host = inetSocketAddress.getHostName(); if (inetAddress != null) { host = inetAddress.getHostAddress(); } return host + ":" + inetSocketAddress.getPort(); } private  InetSocketAddressUtils(); static String asString(SocketAddress socketAddress); static InetSocketAddress[] parseAddressList(String[] addresses); static InetSocketAddress createInetSocketAddress(String address); static InetSocketAddress createInetSocketAddress(String address, int defaultPort); }
InetSocketAddressUtils { public static String asString(SocketAddress socketAddress) { final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; final InetAddress inetAddress = inetSocketAddress.getAddress(); String host = inetSocketAddress.getHostName(); if (inetAddress != null) { host = inetAddress.getHostAddress(); } return host + ":" + inetSocketAddress.getPort(); } private  InetSocketAddressUtils(); static String asString(SocketAddress socketAddress); static InetSocketAddress[] parseAddressList(String[] addresses); static InetSocketAddress createInetSocketAddress(String address); static InetSocketAddress createInetSocketAddress(String address, int defaultPort);  }