Returns a new instance of NetHttpTransport that uses GoogleUtils#getCertificateTrustStore() for the trusted certificates using com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore). If
GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is set to "true", and the default
client certificate key store from Utils#loadDefaultMtlsKeyStore() is not null, then the
transport uses the default client certificate and is mutual TLS.
This helper method doesn't provide for customization of the NetHttpTransport, such
as the ability to specify a proxy. To do use, use com.google.api.client.http.javanet.NetHttpTransport.Builder, for example:
Beta
Returns a new instance of NetHttpTransport that uses GoogleUtils#getCertificateTrustStore() for the trusted certificates using com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore).
mtlsProvider can be used to configure mutual TLS for the transport.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[],null,["# Class GoogleNetHttpTransport (2.8.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.8.1 (latest)](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.8.0](/java/docs/reference/google-api-client/2.8.0/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.7.2](/java/docs/reference/google-api-client/2.7.2/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.6.0](/java/docs/reference/google-api-client/2.6.0/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.5.1](/java/docs/reference/google-api-client/2.5.1/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.4.1](/java/docs/reference/google-api-client/2.4.1/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.1.2](/java/docs/reference/google-api-client/2.1.2/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [2.0.1](/java/docs/reference/google-api-client/2.0.1/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [1.35.2](/java/docs/reference/google-api-client/1.35.2/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [1.34.1](/java/docs/reference/google-api-client/1.34.1/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)\n- [1.33.4](/java/docs/reference/google-api-client/1.33.4/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport) \n\n public class GoogleNetHttpTransport\n\nUtilities for Google APIs based on NetHttpTransport. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e GoogleNetHttpTransport \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### newTrustedTransport()\n\n public static NetHttpTransport newTrustedTransport()\n\nReturns a new instance of NetHttpTransport that uses [GoogleUtils#getCertificateTrustStore()](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.GoogleUtils#com_google_api_client_googleapis_GoogleUtils_getCertificateTrustStore__) for the trusted certificates using com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore). If\n`GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to \"true\", and the default\nclient certificate key store from Utils#loadDefaultMtlsKeyStore() is not null, then the\ntransport uses the default client certificate and is mutual TLS.\n\nThis helper method doesn't provide for customization of the NetHttpTransport, such\nas the ability to specify a proxy. To do use, use com.google.api.client.http.javanet.NetHttpTransport.Builder, for example: \n\n\n static HttpTransport newProxyTransport() throws GeneralSecurityException, IOException {\n NetHttpTransport.Builder builder = new NetHttpTransport.Builder();\n builder.trustCertificates(GoogleUtils.getCertificateTrustStore());\n builder.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(\"127.0.0.1\", 3128)));\n return builder.build();\n }\n \n### newTrustedTransport(MtlsProvider mtlsProvider)\n\n public static NetHttpTransport newTrustedTransport(MtlsProvider mtlsProvider)\n\nBeta \n\nReturns a new instance of NetHttpTransport that uses [GoogleUtils#getCertificateTrustStore()](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.GoogleUtils#com_google_api_client_googleapis_GoogleUtils_getCertificateTrustStore__) for the trusted certificates using com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore).\nmtlsProvider can be used to configure mutual TLS for the transport."]]