Uri implements Serializable { public static boolean isIpAddress(String ipAddress) { Matcher m1 = VALID_IPV4_PATTERN.matcher(ipAddress); if (m1.matches()) { return true; } Matcher m2 = VALID_IPV6_PATTERN.matcher(ipAddress); return m2.matches(); } Uri(String uri); String getRawUriString(); String getUriString(); @Override String toString(); boolean isSingleIp(); boolean isRingId(); String getRawRingId(); String getUri(); @Override boolean equals(Object o); boolean isEmpty(); static boolean isIpAddress(String ipAddress); String getDisplayName(); void setDisplayName(String displayName); String getScheme(); void setScheme(String scheme); String getUsername(); void setUsername(String username); String getHost(); void setHost(String host); String getPort(); void setPort(String port); static final String RING_URI_SCHEME; static final String JAMI_URI_SCHEME; }
@Test public void testBadIPAddress() { assertFalse(Uri.isIpAddress("not an ip")); }
@Test public void testGoodIPAddress() { assertTrue(Uri.isIpAddress("127.0.0.1")); assertTrue(Uri.isIpAddress("2001:db8:0:85a3:0:0:ac1f:8001")); }