code: private static String getHost(final String endpoint) {
          String host = URI.create(endpoint).getHost();
          if (host == null) {
              host = URI.create("http://" + endpoint).getHost();
          }
          return host;
      }
docs: Parse the host portion out of an endpoint (which may or may not
  contain a scheme).
  
  @param endpoint the endpoint to parse
  @return the host portion of the endpoint