code: private boolean isEndpointAvailable(String endpoint) {
          //System.out.println("Check endpoint: " + endpoint);
          try {
              //  Split address and port
              int start = endpoint.indexOf("//");
              if (start<0)  throw new Exception(endpoint + ": Bad syntax");
              int end = endpoint.indexOf(":", start);
              if (end<0)  throw new Exception(endpoint + ": Bad syntax");
              String address = endpoint.substring(start+2, end);
              int    port    = Integer.parseInt(endpoint.substring(end+1));
  
              //  Try to connect
              InetSocketAddress ip = new InetSocketAddress(address, port);
              Socket socket = new Socket();
              socket.connect(ip, 10);
              socket.close();
              return true;
          }
          catch (Exception e) {
              System.err.println(endpoint + " Failed:   " + e.getMessage());
              return false;
          }
      }
docs: ===============================================================