code: public static ApacheHttpTransport newTrustedTransport() throws GeneralSecurityException,
        IOException {
      // Set socket buffer sizes to 8192
      SocketConfig socketConfig =
          SocketConfig.custom()
              .setRcvBufSize(8192)
              .setSndBufSize(8192)
              .build();
  
      PoolingHttpClientConnectionManager connectionManager =
          new PoolingHttpClientConnectionManager(-1, TimeUnit.MILLISECONDS);
  
      // Disable the stale connection check (previously configured in the HttpConnectionParams
      connectionManager.setValidateAfterInactivity(-1);
  
      // Use the included trust store
      KeyStore trustStore = GoogleUtils.getCertificateTrustStore();
      SSLContext sslContext = SslUtils.getTlsSslContext();
      SslUtils.initSslContext(sslContext, trustStore, SslUtils.getPkixTrustManagerFactory());
      LayeredConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
  
      HttpClient client = HttpClientBuilder.create()
          .useSystemProperties()
          .setSSLSocketFactory(socketFactory)
          .setDefaultSocketConfig(socketConfig)
          .setMaxConnTotal(200)
          .setMaxConnPerRoute(20)
          .setRoutePlanner(new SystemDefaultRoutePlanner(ProxySelector.getDefault()))
          .setConnectionManager(connectionManager)
          .disableRedirectHandling()
          .disableAutomaticRetries()
          .build();
      return new ApacheHttpTransport(client);
    }
docs: Returns a new instance of {@link ApacheHttpTransport} that uses
  {@link GoogleUtils#getCertificateTrustStore()} for the trusted certificates.