File tree Expand file tree Collapse file tree
httpclient/src/test/java/org/baeldung/httpclient Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1010import org .apache .http .client .CredentialsProvider ;
1111import org .apache .http .client .methods .CloseableHttpResponse ;
1212import org .apache .http .client .methods .HttpGet ;
13+ import org .apache .http .conn .ssl .NoopHostnameVerifier ;
1314import org .apache .http .impl .client .BasicCredentialsProvider ;
1415import org .apache .http .impl .client .CloseableHttpClient ;
1516import org .apache .http .impl .client .HttpClientBuilder ;
17+ import org .apache .http .impl .client .HttpClients ;
1618import org .junit .After ;
1719import org .junit .Test ;
1820
@@ -58,4 +60,14 @@ public final void givenGetRequestExecuted_whenAnalyzingTheResponse_thenCorrectSt
5860 System .out .println (response .getStatusLine ());
5961 }
6062
63+ @ Test
64+ public final void givenIgnoringCertificates_whenHttpsUrlIsConsumed_thenCorrect () throws ClientProtocolException , IOException {
65+ final CloseableHttpClient httpClient = HttpClients .custom ().setSSLHostnameVerifier (new NoopHostnameVerifier ()).build ();
66+
67+ final HttpGet httpGet = new HttpGet ("https://sesar3.geoinfogeochem.org/sample/igsn/ODP000002" );
68+ httpGet .setHeader ("Accept" , "application/xml" );
69+
70+ response = httpClient .execute (httpGet );
71+ }
72+
6173}
You can’t perform that action at this time.
0 commit comments