code: String toUriString(String defaultScheme, String defaultHostname, int defaultPort) {
          requireNonNull(defaultScheme, "defaultScheme");
          requireNonNull(defaultHostname, "defaultHostname");
          validatePort(defaultPort);
  
          final StringBuilder sb = new StringBuilder();
          sb.append(firstNonNull(uri.getScheme(), defaultScheme)).append("://")
            .append(firstNonNull(uri.getHost(), defaultHostname)).append(':')
            .append(uri.getPort() > 0 ? uri.getPort() : defaultPort)
            .append(uri.getPath());
          return sb.toString();
      }
docs: Returns a {@link URI} of this endpoint as a string. The omitted values in the {@link URI} will be
  replaced with the specified default values, such as {@code defaultScheme}, {@code defaultHostname}
  and {@code defaultPort}.