@Test public void testParseValueInvalid() { try { InetSocketAddressHelper.parse(null); fail(); } catch (NullPointerException e) { } try { InetSocketAddressHelper.parse(""); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse(":"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse("*:"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse(":jake"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse(":70000"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse("localhost:"); fail(); } catch (IllegalArgumentException e) { } }
public static InetSocketAddress parse(String value) { Preconditions.checkNotNull(value); String[] spec = value.split(":", 2); if (spec.length != 2) { throw new IllegalArgumentException("Invalid socket address spec: " + value); } String host = spec[0]; int port = asPort(spec[1]); return StringUtils.isEmpty(host) ? new InetSocketAddress(port) : InetSocketAddress.createUnresolved(host, port); }
InetSocketAddressHelper { public static InetSocketAddress parse(String value) { Preconditions.checkNotNull(value); String[] spec = value.split(":", 2); if (spec.length != 2) { throw new IllegalArgumentException("Invalid socket address spec: " + value); } String host = spec[0]; int port = asPort(spec[1]); return StringUtils.isEmpty(host) ? new InetSocketAddress(port) : InetSocketAddress.createUnresolved(host, port); } }
InetSocketAddressHelper { public static InetSocketAddress parse(String value) { Preconditions.checkNotNull(value); String[] spec = value.split(":", 2); if (spec.length != 2) { throw new IllegalArgumentException("Invalid socket address spec: " + value); } String host = spec[0]; int port = asPort(spec[1]); return StringUtils.isEmpty(host) ? new InetSocketAddress(port) : InetSocketAddress.createUnresolved(host, port); } private  InetSocketAddressHelper(); }
InetSocketAddressHelper { public static InetSocketAddress parse(String value) { Preconditions.checkNotNull(value); String[] spec = value.split(":", 2); if (spec.length != 2) { throw new IllegalArgumentException("Invalid socket address spec: " + value); } String host = spec[0]; int port = asPort(spec[1]); return StringUtils.isEmpty(host) ? new InetSocketAddress(port) : InetSocketAddress.createUnresolved(host, port); } private  InetSocketAddressHelper(); static InetSocketAddress parse(String value); static String toString(InetSocketAddress value); }
InetSocketAddressHelper { public static InetSocketAddress parse(String value) { Preconditions.checkNotNull(value); String[] spec = value.split(":", 2); if (spec.length != 2) { throw new IllegalArgumentException("Invalid socket address spec: " + value); } String host = spec[0]; int port = asPort(spec[1]); return StringUtils.isEmpty(host) ? new InetSocketAddress(port) : InetSocketAddress.createUnresolved(host, port); } private  InetSocketAddressHelper(); static InetSocketAddress parse(String value); static String toString(InetSocketAddress value);  }