code: public static boolean urisEqualAfterPortNormalization(final URI uri1, final URI uri2) {
          if (uri1 == null && uri2 == null) {
              return true;
          }
          if (uri1 == null || uri2 == null) {
              return false;
          }
          
          try {
              URI normalizedUri1 = normalizePortNumbersInUri(uri1);
              URI normalizedUri2 = normalizePortNumbersInUri(uri2);
              boolean eq = normalizedUri1.equals(normalizedUri2);
              return eq;
          } catch (URISyntaxException use) {
              logger.error("Cannot compare 2 URIs.", use);
              return false;    
          }
      }
docs: Compares two URIs for equality, ignoring default port numbers for selected protocols.
  
  By default, {@link URI#equals(Object)} doesn't take into account default port numbers, so http://server:80/resource is a different
  URI than http://server/resource.
  
  And URLs should not be used for comparison, as written here:
  http://stackoverflow.com/questions/3771081/proper-way-to-check-for-url-equality
  
  @param uri1
  URI 1 to be compared.
  @param uri2
  URI 2 to be compared.
  
  @return True if both URIs are equal.