Skip to content

Commit 2995046

Browse files
author
eugenp
committed
adding a sandbox test
1 parent f9ec757 commit 2995046

2 files changed

Lines changed: 12 additions & 188 deletions

File tree

httpclient/src/test/java/org/baeldung/httpclient/SandboxLiveTest.java

Lines changed: 0 additions & 188 deletions
This file was deleted.

httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
import org.apache.http.client.CredentialsProvider;
1111
import org.apache.http.client.methods.CloseableHttpResponse;
1212
import org.apache.http.client.methods.HttpGet;
13+
import org.apache.http.conn.ssl.NoopHostnameVerifier;
1314
import org.apache.http.impl.client.BasicCredentialsProvider;
1415
import org.apache.http.impl.client.CloseableHttpClient;
1516
import org.apache.http.impl.client.HttpClientBuilder;
17+
import org.apache.http.impl.client.HttpClients;
1618
import org.junit.After;
1719
import 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
}

0 commit comments

Comments
 (0)