@Test public void toAddress() throws Exception { Assert.assertEquals(new InetSocketAddress("localhost", 555), NetUtils.toAddress("localhost:555")); Assert.assertEquals(new InetSocketAddress("127.0.0.1", 555), NetUtils.toAddress("localhost:555")); }
public static InetSocketAddress toAddress(String address) { int i = address.indexOf(':'); String host; int port; if (i > -1) { host = address.substring(0, i); port = Integer.parseInt(address.substring(i + 1)); } else { host = address; port = 0; } return new InetSocketAddress(host, port); }
NetUtils { public static InetSocketAddress toAddress(String address) { int i = address.indexOf(':'); String host; int port; if (i > -1) { host = address.substring(0, i); port = Integer.parseInt(address.substring(i + 1)); } else { host = address; port = 0; } return new InetSocketAddress(host, port); } }
NetUtils { public static InetSocketAddress toAddress(String address) { int i = address.indexOf(':'); String host; int port; if (i > -1) { host = address.substring(0, i); port = Integer.parseInt(address.substring(i + 1)); } else { host = address; port = 0; } return new InetSocketAddress(host, port); }  }
NetUtils { public static InetSocketAddress toAddress(String address) { int i = address.indexOf(':'); String host; int port; if (i > -1) { host = address.substring(0, i); port = Integer.parseInt(address.substring(i + 1)); } else { host = address; port = 0; } return new InetSocketAddress(host, port); }  static int getRandomPort(); static int getAvailablePort(); static int getAvailablePort(int port); static boolean isValidAddress(String address); static boolean isLocalHost(String host); static boolean isAnyHost(String host); static boolean isInvalidLocalHost(String host); static boolean isValidLocalHost(String host); static InetSocketAddress getLocalSocketAddress(String host, int port); static String getLocalHost(); static String filterLocalHost(String host); static InetAddress getLocalAddress(); static String getLogHost(); static String getHostName(String address); static String getIpByHost(String hostName); static String toAddressString(InetSocketAddress address); static InetSocketAddress toAddress(String address); static String toURL(String protocol, String host, int port, String path); }
NetUtils { public static InetSocketAddress toAddress(String address) { int i = address.indexOf(':'); String host; int port; if (i > -1) { host = address.substring(0, i); port = Integer.parseInt(address.substring(i + 1)); } else { host = address; port = 0; } return new InetSocketAddress(host, port); }  static int getRandomPort(); static int getAvailablePort(); static int getAvailablePort(int port); static boolean isValidAddress(String address); static boolean isLocalHost(String host); static boolean isAnyHost(String host); static boolean isInvalidLocalHost(String host); static boolean isValidLocalHost(String host); static InetSocketAddress getLocalSocketAddress(String host, int port); static String getLocalHost(); static String filterLocalHost(String host); static InetAddress getLocalAddress(); static String getLogHost(); static String getHostName(String address); static String getIpByHost(String hostName); static String toAddressString(InetSocketAddress address); static InetSocketAddress toAddress(String address); static String toURL(String protocol, String host, int port, String path); static final String LOCALHOST; static final String ANYHOST; }