code: public URI toURI() {
          String url = toString();
          try {
              return new URI(url);
          } catch (URISyntaxException e) {
              throw new RuntimeException("Cannot convert to URI: " + url, e);
          }
      }
docs: Converts this HttpURL to a {@link URI}, making sure
  appropriate characters are escaped properly.
  @return a URI
  @since 1.7.0
  @throws RuntimeException when URL is malformed