PID implements Serializable { public static PID fromString(String pid) throws IllegalArgumentException { List<String> components = Splitter.on("@").omitEmptyStrings().splitToList(pid); if (components.size() != 2) { throw new IllegalArgumentException( "Illegal libprocess pid: " + pid + ". Format is id@host:port."); } String id = components.get(0); if (CharMatcher.WHITESPACE.matchesAnyOf(id)) { throw new IllegalArgumentException("No whitespace allowed in process id."); } HostAndPort hostAndPort = HostAndPort.fromString(components.get(1)) .requireBracketsForIPv6(); if (!hostAndPort.hasPort()) { throw new IllegalArgumentException("No port specified."); } return new PID(id, hostAndPort); } PID(String id, HostAndPort hostAndPort); static PID fromString(String pid); String getId(); HostAndPort getHostAndPort(); URL getBaseUrl(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testFromString() throws Exception { PID pid = PID.fromString("scheduler@192.168.1.1:8081"); assertEquals("scheduler@192.168.1.1:8081", pid.toString()); assertEquals("http: }