### Question:
ServerName implements Comparable<ServerName> { public static ServerName parseServerName(final String str) { return SERVERNAME_PATTERN.matcher(str).matches()? new ServerName(str): new ServerName(str, NON_STARTCODE); } ServerName(final String hostname, final int port, final long startcode);  ServerName(final String serverName);  ServerName(final String hostAndPort, final long startCode); static String parseHostname(final String serverName); static int parsePort(final String serverName); static long parseStartcode(final String serverName); @Override String toString(); synchronized byte [] getVersionedBytes(); String getServerName(); String getHostname(); int getPort(); long getStartcode(); static String getServerName(String hostName, int port, long startcode); static String getServerName(final String hostAndPort,
      final long startcode); String getHostAndPort(); static long getServerStartcodeFromServerName(final String serverName); static String getServerNameLessStartCode(String inServerName); @Override int compareTo(ServerName other); @Override int hashCode(); @Override boolean equals(Object o); static ServerName findServerWithSameHostnamePort(final Collection<ServerName> names,
      final ServerName serverName); static boolean isSameHostnameAndPort(final ServerName left,
      final ServerName right); static ServerName parseVersionedServerName(final byte [] versionedBytes); static ServerName parseServerName(final String str); static final int NON_STARTCODE; static final String SERVERNAME_SEPARATOR; static Pattern SERVERNAME_PATTERN; static final String UNKNOWN_SERVERNAME; }### Answer:
@Test public void testRegexPatterns() { assertTrue(Pattern.matches(Addressing.VALID_PORT_REGEX, "123")); assertFalse(Pattern.matches(Addressing.VALID_PORT_REGEX, "")); assertTrue(ServerName.SERVERNAME_PATTERN.matcher("www1.example.org,1234,567").matches()); ServerName.parseServerName("a.b.c,58102,1319771740322"); ServerName.parseServerName("192.168.1.199,58102,1319771740322"); ServerName.parseServerName("a.b.c:58102"); ServerName.parseServerName("192.168.1.199:58102"); }