code: public static NetHttpTransport createNetHttpTransport(
        @Nullable URI proxyUri, @Nullable PasswordAuthentication proxyAuth)
        throws IOException, GeneralSecurityException {
      checkArgument(
          proxyUri != null || proxyAuth == null,
          "if proxyUri is null than proxyAuth should be null too");
  
      if (proxyAuth != null) {
        Authenticator.setDefault(
            new Authenticator() {
              @Override
              protected PasswordAuthentication getPasswordAuthentication() {
                if (getRequestorType() == RequestorType.PROXY
                    && getRequestingHost().equalsIgnoreCase(proxyUri.getHost())
                    && getRequestingPort() == proxyUri.getPort()) {
                  return proxyAuth;
                }
                return null;
              }
            });
      }
  
      return new NetHttpTransport.Builder()
          .trustCertificates(GoogleUtils.getCertificateTrustStore())
          .setProxy(
              proxyUri == null
                  ? null
                  : new Proxy(
                      Proxy.Type.HTTP, new InetSocketAddress(proxyUri.getHost(), proxyUri.getPort())))
          .build();
    }
docs: Create an {@link NetHttpTransport} for calling Google APIs with an optional HTTP proxy.
  
  @param proxyUri Optional HTTP proxy URI to use with the transport.
  @param proxyAuth Optional HTTP proxy credentials to authenticate with the transport proxy.
  @return The resulting HttpTransport.
  @throws IOException If there is an issue connecting to Google's certification server.
  @throws GeneralSecurityException If there is a security issue with the keystore.