boolean (String host, int port) { try (ServerSocket socket = new ServerSocket()) { //it looks like this flag should be set but it leads to incorrect results for NodeJS under Windows //socket.setReuseAddress(true); socket.bind(new InetSocketAddress(host, port)); return true; } catch (IOException e) { LOG.debug(e); return false; } }