ServerUtil { public static boolean checkHostAndPort(String serverHost, int serverPort) { return StringUtil.isNotEmpty(serverHost) && isPort(serverPort); }  static boolean isIpv4(String ip); static int getNewPort(); @SneakyThrows static int getNewPort(String key); static boolean isPort(int serverPort); static boolean isSocketPort(int serverPort); static boolean checkHostAndPort(String serverHost, int serverPort); static String buildCacheKey(String serverHost, int serverPort);  }
@Test public void testCheckHostAndPort() { assertTrue(ServerUtil.checkHostAndPort(TestConstants.LOCAL_HOST, 8080)); assertFalse(ServerUtil.checkHostAndPort("", 6666)); assertFalse(ServerUtil.checkHostAndPort(TestConstants.LOCAL_HOST, 65536)); }