RemoteInterpreterUtils { public static int findRandomAvailablePortOnAllLocalInterfaces() throws IOException { int port; try (ServerSocket socket = new ServerSocket(0);) { port = socket.getLocalPort(); socket.close(); } return port; }  static int findRandomAvailablePortOnAllLocalInterfaces(); static boolean checkIfRemoteEndpointAccessible(String host, int port);  }
@Test public void testFindRandomAvailablePortOnAllLocalInterfaces() throws IOException { assertTrue(RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces() > 0); }