### Question:
NetUtil { public static boolean isIpPortStr(String str) { if (StringUtils.isBlank(str) || !str.contains(Constants.COLON)) { return false; } String[] strs = str.split(Constants.COLON); if (strs.length != 2) { return false; } String ip = strs[0]; if (!IP_PATTERN.matcher(ip).matches()) { return false; } String portStr = strs[1]; if (!PORT_PATTERN.matcher(portStr).matches()) { return false; } return true; }  static String getLocalHost(); static InetAddress getLocalAddress(); static InetAddress getLocalIpV4Adress(); static String getIpByHost(String hostName); static String toIpPort(InetSocketAddress address); static String toIP(InetSocketAddress address); static int toPort(InetSocketAddress address); static String toHostPort(InetSocketAddress address); static InetSocketAddress toAddress(String address); static int getAvailablePort(int defaultPort); static boolean isIpPortStr(String str); static boolean isPortInUse(int port); static final String LOCAL_HOST; static final String ANY_HOST; static final int MAX_PORT; }### Answer:
@Test public void testIsIpPortStr() { String str1 = "10.10:99"; String str2 = "10:1221"; String str3 = "10.10.10.1:100"; String str4 = "10.10.:2000"; String str5 = "10.10.10.1:100000"; String str6 = "10.10.10.1:9999"; String str7 = "10.10.10.1:30000"; Assert.assertFalse(NetUtil.isIpPortStr(str1)); Assert.assertFalse(NetUtil.isIpPortStr(str2)); Assert.assertFalse(NetUtil.isIpPortStr(str3)); Assert.assertFalse(NetUtil.isIpPortStr(str4)); Assert.assertFalse(NetUtil.isIpPortStr(str5)); Assert.assertTrue(NetUtil.isIpPortStr(str6)); Assert.assertTrue(NetUtil.isIpPortStr(str7)); }