code: public String getAuthority(HttpUrl url) {
          String scheme = url.scheme();
          String host = url.host();
          int port = url.port();
          StringBuilder builder = new StringBuilder();
          if (scheme != null) {
              builder.append(scheme).append("://");
          }
          builder.append(host);
          if (port >= 0) {
              builder.append(':').append(port);
          }
          return builder.toString();
      }
docs: Gets authority of a url.
  
  @param url
  the url to get the authority for.
  @return the authority.