code: private static URI normalizePortNumbersInUri(final URI uri) throws URISyntaxException {
          int port = uri.getPort();
          final String scheme = uri.getScheme();
  
          if (SCHEME_HTTP.equals(scheme) && port == DEFAULT_HTTP_PORT) {
              port = -1;
          }
          if (SCHEME_HTTPS.equals(scheme) && port == DEFAULT_HTTPS_PORT) {
              port = -1;
          }
          
          final URI result = new URI(scheme, uri.getUserInfo(), uri.getHost(), port, uri.getPath(), uri.getQuery(), uri.getFragment());
          return result;
      }
docs: Normalizes a URI. If it contains the default port for the used scheme, the method replaces the port with "default".
  
  @param uri
  The URI to normalize.
  
  @return A normalized URI.
  
  @throws URISyntaxException
  If a URI cannot be created because of wrong syntax.