code: public static boolean validateResource(URI uri) {
          return uri != null && uri.getPort() != -1 && uri.getHost() != null;
      }
docs: Validate the correctness of the host and port in a given URI.
  
  @return true if the address and port are valid.