code: protected String getFullAuthority(URI uri) {
          String authority = uri.getAuthority();
          if (!authority.contains(":") && uri.getPort() > 0) {
              // Append port for complete authority
              authority = String.format("%s:%d", uri.getAuthority(), uri.getPort());
          }
          return authority;
      }
docs: Gets full authority for a URL by appending port to the url authority.
  @param uri the URL to get the full authority for.
  @return the full authority.