Created
October 12, 2017 14:52
-
-
Save Ladicek/fe783b7f871e33f5cf4c403065714ddd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSLContext sslContext = SSLContexts.custom() | |
.loadTrustMaterial((TrustStrategy) (chain, authType) -> true) | |
.build(); | |
try (CloseableHttpClient httpClient = HttpClients.custom() | |
.setSSLContext(sslContext) | |
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) | |
.build()) { | |
String response = Executor.newInstance(httpClient) | |
.execute(Request.Get("https://localhost:8443/")) | |
.returnContent().asString(); | |
assertThat(response).isEqualTo("Hello on port 8443, secure: true"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment