### Question:
PortValidator { public static boolean checkPort(int port) { try (ServerSocket serverSocket = new ServerSocket()) { serverSocket.bind(new InetSocketAddress(port)); return true; } catch (Exception exception) { return false; } }  static boolean checkPort(int port); static boolean checkHost(String host, int port); static int findFreePort(int startPort);  }### Answer:
@Test public void testPortValidator() { int port = 45893; Assert.assertTrue(PortValidator.checkPort(port)); }