File tree 1 file changed +5
-3
lines changed
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
116
116
117
117
[source,java]
118
118
--------------------------------------------------
119
- KeyStore keystore = KeyStore.getInstance("jks");
119
+ KeyStore truststore = KeyStore.getInstance("jks");
120
120
try (InputStream is = Files.newInputStream(keyStorePath)) {
121
- keystore .load(is, keyStorePass.toCharArray());
121
+ truststore .load(is, keyStorePass.toCharArray());
122
122
}
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"))
124
126
.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
125
127
@Override
126
128
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
You can’t perform that action at this time.
0 commit comments