ServerUtil { public static boolean isPort(int serverPort) { return serverPort > 0 && serverPort <= 0xFFFF; }  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 testisPort() { assertTrue(ServerUtil.isPort(8080)); assertTrue(ServerUtil.isPort(80)); assertFalse(ServerUtil.isPort(-1)); assertFalse(ServerUtil.isPort(65536)); }