docs: public static boolean isTcpPortAvailable(String hostname, int port) {
          try (ServerSocket serverSocket = new ServerSocket()) {
              // setReuseAddress(false) is required only on OSX,
              // otherwise the code will not work correctly on that platform
              serverSocket.setReuseAddress(false);
              serverSocket.bind(new InetSocketAddress(InetAddress.getByName(hostname), port), 1);
              return true;
          } catch (Exception ex) {
              return false;
          }
      }