code: static HttpUrl getChecked(String url) throws MalformedURLException, UnknownHostException {
          Builder builder = new Builder();
          Builder.ParseResult result = builder.parse(null, url);
          switch (result) {
              case SUCCESS:
                  return builder.build();
              case INVALID_HOST:
                  throw new UnknownHostException("Invalid host: " + url);
              case UNSUPPORTED_SCHEME:
              case MISSING_SCHEME:
              case INVALID_PORT:
              default:
                  throw new MalformedURLException("Invalid URL: " + result + " for " + url);
          }
      }
docs: Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS
  URL, or throws an exception if it isn't.
  
  @throws MalformedURLException if there was a non-host related URL issue
  @throws UnknownHostException if the host was invalid