Skip to content

Commit c13a592

Browse files
committed
fixed formatting and added additional test
1 parent 7ac1287 commit c13a592

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

google-api-client-apache-v5/src/main/java/com/google/api/client/googleapis/apache/v5/GoogleApache5HttpTransport.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ public final class GoogleApache5HttpTransport {
4747

4848
/**
4949
* Returns a new instance of {@link Apache5HttpTransport} that uses default jdk certificates for
50-
* the trusted certificates. If `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set
51-
* to "true", and the default client certificate key store from {@link Utils#loadDefaultMtlsKeyStore()}
52-
* is not null, then the transport uses the default client certificate and is mutual TLS.
50+
* the trusted certificates. If `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to
51+
* "true", and the default client certificate key store from {@link
52+
* Utils#loadDefaultMtlsKeyStore()} is not null, then the transport uses the default client
53+
* certificate and is mutual TLS.
5354
*/
5455
public static Apache5HttpTransport newTrustedTransport()
5556
throws GeneralSecurityException, IOException {
@@ -58,9 +59,8 @@ public static Apache5HttpTransport newTrustedTransport()
5859

5960
/**
6061
* {@link Beta} <br>
61-
* Returns a new instance of {@link Apache5HttpTransport} that uses default jdk certificates
62-
* for the trusted certificates. mtlsProvider can be used to configure mutual TLS for the
63-
* transport.
62+
* Returns a new instance of {@link Apache5HttpTransport} that uses default jdk certificates for
63+
* the trusted certificates. mtlsProvider can be used to configure mutual TLS for the transport.
6464
*
6565
* @param mtlsProvider MtlsProvider to configure mutual TLS for the transport
6666
*/

google-api-client-apache-v5/src/test/java/com/google/api/client/googleapis/apache/v5/ITGoogleApache5HttpTransportTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,23 @@ public Void handleResponse(ClassicHttpResponse response) {
7474
}
7575
});
7676
}
77+
78+
@Test
79+
public void testHttpRequestPassesWhenMakingRequestToSiteContainedInDefaultCerts()
80+
throws Exception {
81+
Apache5HttpTransport apache5HttpTransport = GoogleApache5HttpTransport.newTrustedTransport();
82+
HttpGet httpGet = new HttpGet("https://central.sonatype.com/");
83+
84+
apache5HttpTransport
85+
.getHttpClient()
86+
.execute(
87+
httpGet,
88+
new HttpClientResponseHandler<Void>() {
89+
@Override
90+
public Void handleResponse(ClassicHttpResponse response) {
91+
assertEquals(200, response.getCode());
92+
return null;
93+
}
94+
});
95+
}
7796
}

google-api-client/src/main/java/com/google/api/client/googleapis/apache/v2/GoogleApacheHttpTransport.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ public final class GoogleApacheHttpTransport {
4646

4747
/**
4848
* Returns a new instance of {@link ApacheHttpTransport} that uses default jdk certificates for
49-
* the trusted certificates. If `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set
50-
* to "true", and the default client certificate key store from {@link Utils#loadDefaultMtlsKeyStore()}
51-
* is not null, then the transport uses the default client certificate and is mutual TLS.
49+
* the trusted certificates. If `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is set to
50+
* "true", and the default client certificate key store from {@link
51+
* Utils#loadDefaultMtlsKeyStore()} is not null, then the transport uses the default client
52+
* certificate and is mutual TLS.
5253
*/
5354
public static ApacheHttpTransport newTrustedTransport()
5455
throws GeneralSecurityException, IOException {
@@ -57,8 +58,8 @@ public static ApacheHttpTransport newTrustedTransport()
5758

5859
/**
5960
* {@link Beta} <br>
60-
* Returns a new instance of {@link ApacheHttpTransport} that default jdk certs for the
61-
* trusted certificates. mtlsProvider can be used to configure mutual TLS for the transport.
61+
* Returns a new instance of {@link ApacheHttpTransport} that default jdk certs for the trusted
62+
* certificates. mtlsProvider can be used to configure mutual TLS for the transport.
6263
*
6364
* @param mtlsProvider MtlsProvider to configure mutual TLS for the transport
6465
*/

0 commit comments

Comments
 (0)