File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -116,11 +116,13 @@ https://hc.apache.org/httpcomponents-asyncclient-dev/httpasyncclient/apidocs/org
116116
117117[source,java]
118118--------------------------------------------------
119- KeyStore keystore = KeyStore.getInstance("jks");
119+ KeyStore truststore = KeyStore.getInstance("jks");
120120try (InputStream is = Files.newInputStream(keyStorePath)) {
121- keystore .load(is, keyStorePass.toCharArray());
121+ truststore .load(is, keyStorePass.toCharArray());
122122}
123- RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200))
123+ SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(truststore, null);
124+ final SSLContext sslContext = sslBuilder.build();
125+ RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200, "https"))
124126 .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
125127 @Override
126128 public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
You can’t perform that action at this time.
0 commit comments