# Couldn't instantiate rest high level client with SSL enabled at HTTP layer.

**URL:** <https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659>\
**Category:** Search Guard\
**Created:** [October 30, 2017, 8:16am UTC](https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659 "2017-10-30T08:16:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kutty\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@Kutty\_Kumar](https://forum.search-guard.com/u/Kutty_Kumar)\
**Post date:** [October 30, 2017, 8:16am UTC](https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659/1 "2017-10-30T08:16:02Z")

</div>

When asking questions, please provide the following information:

Guys i have a cluster which is running with elasticsearch 5.6.2, and it has searchguard plugin enabled, also SSL is enabled for both the transport layer as well as the http layer, when i execute the following curl command from the terminal  
`curl -k -u user:password https://localhost:9200`, the response is returned and its fine, but when i instantiate a high level rest client using the following code

```
    public RccRestClient()
throws NodeValidationException, IOException, CertificateException, NoSuchAlgorithmException,
KeyStoreException, KeyManagementException, UnrecoverableKeyException {
SSLContextBuilder sslBuilder = SSLContexts.custom()
    //.loadTrustMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/truststore.jks"),"password".toCharArray());
            .loadKeyMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/0-keystore.jks"),"password".toCharArray(),"password".toCharArray());
final SSLContext sslContext = sslBuilder.build();

final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
    new UsernamePasswordCredentials("user", "password"));

Header[] defaultHeaders = new Header[] {
    new BasicHeader("Authorization", "Basic " + encodeBase64("user:password".getBytes())) };
RestClientBuilder restClientBuilder = RestClient
    .builder(new HttpHost("localhost",
        Integer.valueOf("9200"), "https"))
    .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
        @Override
        public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
            return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
        }
    });
// .setHttpClientConfigCallback(
// new RestClientBuilder.HttpClientConfigCallback() {
// @Override
// public HttpAsyncClientBuilder customizeHttpClient(
// HttpAsyncClientBuilder httpClientBuilder) {
// httpClientBuilder.setDefaultHeaders(Arrays.asList(defaultHeaders));
// httpClientBuilder.setSSLContext(sslContext);
// return httpClientBuilder;
// }
// }
//
// );
restClientBuilder.setMaxRetryTimeoutMillis(10000);
restClientBuilder.setDefaultHeaders(defaultHeaders);
restClientBuilder.setFailureListener(new RestClient.FailureListener() {
    @Override
    public void onFailure(HttpHost host) {
        LOGGER.error("Couldn't initialize Low Level Rest Client");
        System.exit(-1);
    }
});

```

i am getting IO exception saying with timeouts, there is no error being logged. what is the correct way to achieve this.

- Search Guard and Elasticsearch version

- Installed and used enterprise modules, if any

- JVM version and operating system version

- Search Guard configuration files

- Elasticsearch log messages on debug level

- Other installed Elasticsearch or Kibana plugins, if any

---

<div class="post-metadata">

**Author:** ![searchguard\_google\_group](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/searchguard_google_group/32/462_2.png) [@searchguard\_google\_group](https://forum.search-guard.com/u/searchguard_google_group)\
**Post date:** [November 1, 2017, 8:29pm UTC](https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659/2 "2017-11-01T20:29:24Z")

</div>

see [search-guard-module-auditlog/src/main/java/com/floragunn/searchguard/httpclient/HttpClient.java at master · floragunncom/search-guard-module-auditlog · GitHub](https://github.com/floragunncom/search-guard-module-auditlog/blob/master/src/main/java/com/floragunn/searchguard/httpclient/HttpClient.java)

> **···**
>
> > Am 30.10.2017 um 09:16 schrieb Kutty Kumar \<kutty.aarathorn@gmail.com\>:
> > 
> > When asking questions, please provide the following information:
> > 
> > Guys i have a cluster which is running with elasticsearch 5.6.2, and it has searchguard plugin enabled, also SSL is enabled for both the transport layer as well as the http layer, when i execute the following curl command from the terminal  
> > `curl -k -u user:password [https://localhost:9200](https://localhost:9200)`, the response is returned and its fine, but when i instantiate a high level rest client using the following code
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public RccRestClient()  
> > &nbsp;&nbsp;&nbsp;&nbsp;throws NodeValidationException, IOException, CertificateException, NoSuchAlgorithmException,  
> > &nbsp;&nbsp;&nbsp;&nbsp;KeyStoreException, KeyManagementException, UnrecoverableKeyException {  
> > &nbsp;&nbsp;&nbsp;&nbsp;SSLContextBuilder sslBuilder = SSLContexts.custom()  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//.loadTrustMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/truststore.jks"),"password".toCharArray());  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.loadKeyMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/0-keystore.jks"),"password".toCharArray(),"password".toCharArray());  
> > &nbsp;&nbsp;&nbsp;&nbsp;final SSLContext sslContext = sslBuilder.build();
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();  
> > &nbsp;&nbsp;&nbsp;&nbsp;credentialsProvider.setCredentials(AuthScope.ANY,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new UsernamePasswordCredentials("user", "password"));
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Header defaultHeaders = new Header {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new BasicHeader("Authorization", "Basic " + encodeBase64("user:password".getBytes())) };  
> > &nbsp;&nbsp;&nbsp;&nbsp;RestClientBuilder restClientBuilder = RestClient  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.builder(new HttpHost("localhost",  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer.valueOf("9200"), "https"))  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@Override  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});  
> > &nbsp;&nbsp;&nbsp;&nbsp;// .setHttpClientConfigCallback(  
> > &nbsp;&nbsp;&nbsp;&nbsp;// new RestClientBuilder.HttpClientConfigCallback() {  
> > &nbsp;&nbsp;&nbsp;&nbsp;// @Override  
> > &nbsp;&nbsp;&nbsp;&nbsp;// public HttpAsyncClientBuilder customizeHttpClient(  
> > &nbsp;&nbsp;&nbsp;&nbsp;// HttpAsyncClientBuilder httpClientBuilder) {  
> > &nbsp;&nbsp;&nbsp;&nbsp;// httpClientBuilder.setDefaultHeaders(Arrays.asList(defaultHeaders));  
> > &nbsp;&nbsp;&nbsp;&nbsp;// httpClientBuilder.setSSLContext(sslContext);  
> > &nbsp;&nbsp;&nbsp;&nbsp;// return httpClientBuilder;  
> > &nbsp;&nbsp;&nbsp;&nbsp;// }  
> > &nbsp;&nbsp;&nbsp;&nbsp;// }  
> > &nbsp;&nbsp;&nbsp;&nbsp;//  
> > &nbsp;&nbsp;&nbsp;&nbsp;// );  
> > &nbsp;&nbsp;&nbsp;&nbsp;restClientBuilder.setMaxRetryTimeoutMillis(10000);  
> > &nbsp;&nbsp;&nbsp;&nbsp;restClientBuilder.setDefaultHeaders(defaultHeaders);  
> > &nbsp;&nbsp;&nbsp;&nbsp;restClientBuilder.setFailureListener(new RestClient.FailureListener() {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@Override  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void onFailure(HttpHost host) {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOGGER.error("Couldn't initialize Low Level Rest Client");  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.exit(-1);  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;&nbsp;});  
> > i am getting IO exception saying with timeouts, there is no error being logged. what is the correct way to achieve this.
> > 
> > \* Search Guard and Elasticsearch version  
> > \* Installed and used enterprise modules, if any  
> > \* JVM version and operating system version  
> > \* Search Guard configuration files  
> > \* Elasticsearch log messages on debug level  
> > \* Other installed Elasticsearch or Kibana plugins, if any
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "Search Guard Community Forum" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to search-guard+unsubscribe@googlegroups.com.  
> > To post to this group, send email to search-guard@googlegroups.com.  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/search-guard/bd272c28-f257-456b-98e4-e0e165fd2d4d%40googlegroups.com\](https://groups.google.com/d/msgid/search-guard/bd272c28-f257-456b-98e4-e0e165fd2d4d%40googlegroups.com%5C).  
> > For more options, visit [https://groups.google.com/d/optout\](https://groups.google.com/d/optout%5C).

---

<div class="post-metadata">

**Author:** ![Kasinaat\_Selvi\_Sukesh](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/kasinaat_selvi_sukesh/32/500_2.png) [@Kasinaat\_Selvi\_Sukesh](https://forum.search-guard.com/u/Kasinaat_Selvi_Sukesh)\
**Post date:** [January 25, 2019, 10:34am UTC](https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659/3 "2019-01-25T10:34:03Z")

</div>

Here you are using java keystore.What should I do if I want to use client certificate authentication?

> **···**
>
> On Monday, October 30, 2017 at 1:46:02 PM UTC+5:30, Kutty Kumar wrote:
> 
> > When asking questions, please provide the following information:
> > 
> > Guys i have a cluster which is running with elasticsearch 5.6.2, and it has searchguard plugin enabled, also SSL is enabled for both the transport layer as well as the http layer, when i execute the following curl command from the terminal  
> > `curl -k -u user:password https://localhost:9200`, the response is returned and its fine, but when i instantiate a high level rest client using the following code
> > 
> > ```
> > public RccRestClient()
> > throws NodeValidationException, IOException, CertificateException, NoSuchAlgorithmException,
> > KeyStoreException, KeyManagementException, UnrecoverableKeyException {
> > SSLContextBuilder sslBuilder = SSLContexts.custom()
> > //.loadTrustMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/truststore.jks"),"password".toCharArray());
> > .loadKeyMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/0-keystore.jks"),"password".toCharArray(),"password".toCharArray());
> > final SSLContext sslContext = sslBuilder.build();
> > 
> > final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
> > credentialsProvider.setCredentials(AuthScope.ANY,
> > new UsernamePasswordCredentials("user", "password"));
> > 
> > Header[] defaultHeaders = new Header[] {
> > new BasicHeader("Authorization", "Basic " + encodeBase64("user:password".getBytes())) };
> > RestClientBuilder restClientBuilder = RestClient
> > .builder(new HttpHost("localhost",
> > Integer.valueOf("9200"), "https"))
> > .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
> > @Override
> > public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
> > return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
> > }
> > });
> > // .setHttpClientConfigCallback(
> > // new RestClientBuilder.HttpClientConfigCallback() {
> > // @Override
> > // public HttpAsyncClientBuilder customizeHttpClient(
> > // HttpAsyncClientBuilder httpClientBuilder) {
> > // httpClientBuilder.setDefaultHeaders(Arrays.asList(defaultHeaders));
> > // httpClientBuilder.setSSLContext(sslContext);
> > // return httpClientBuilder;
> > // }
> > // }
> > //
> > // );
> > restClientBuilder.setMaxRetryTimeoutMillis(10000);
> > restClientBuilder.setDefaultHeaders(defaultHeaders);
> > restClientBuilder.setFailureListener(new RestClient.FailureListener() {
> > @Override
> > public void onFailure(HttpHost host) {
> > LOGGER.error("Couldn't initialize Low Level Rest Client");
> > System.exit(-1);
> > }
> > });
> > 
> > ```
> > 
> > i am getting IO exception saying with timeouts, there is no error being logged. what is the correct way to achieve this.
> 
> > - Search Guard and Elasticsearch version
> 
> > - Installed and used enterprise modules, if any
> 
> > - JVM version and operating system version
> 
> > - Search Guard configuration files
> 
> > - Elasticsearch log messages on debug level
> 
> > - Other installed Elasticsearch or Kibana plugins, if any

---

<div class="post-metadata">

**Author:** ![11111](https://avatars.discourse-cdn.com/v4/letter/1/73ab20/32.png) [@11111](https://forum.search-guard.com/u/11111)\
**Post date:** [January 25, 2019, 1:04pm UTC](https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659/4 "2019-01-25T13:04:41Z")

</div>

I am using high level rest client, and I am just trying to use the account and password to connect to the cluster. I don’t know about certificate verification. You can check the description in this link.

> **[Accesiblty of index through java code](https://forum.readonlyrest.com/t/accesiblty-of-index-through-java-code/584)**
>
> Hi, after successully setting the Elasticsearch and kibana over ReadOnlyRest, I want to access my index using my java code. I have a little bit knowledge of Transport Client. Can you help me how can i do this. Thanks Akhilesh Tiwari

Kasinaat Selvi Sukesh [kasinaat007@gmail.com](mailto:kasinaat007@gmail.com)于2019年1月25日 周五下午6:34写道：

> **···**
>
> > Here you are using java keystore.What should I do if I want to use client certificate authentication?
> > 
> > On Monday, October 30, 2017 at 1:46:02 PM UTC+5:30, Kutty Kumar wrote:
> > 
> > > When asking questions, please provide the following information:
> > > 
> > > Guys i have a cluster which is running with elasticsearch 5.6.2, and it has searchguard plugin enabled, also SSL is enabled for both the transport layer as well as the http layer, when i execute the following curl command from the terminal  
> > > `curl -k -u user:password https://localhost:9200`, the response is returned and its fine, but when i instantiate a high level rest client using the following code
> > > 
> > > ```
> > > public RccRestClient()
> > > throws NodeValidationException, IOException, CertificateException, NoSuchAlgorithmException,
> > > KeyStoreException, KeyManagementException, UnrecoverableKeyException {
> > > SSLContextBuilder sslBuilder = SSLContexts.custom()
> > > //.loadTrustMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/truststore.jks"),"password".toCharArray());
> > > .loadKeyMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/0-keystore.jks"),"password".toCharArray(),"password".toCharArray());
> > > final SSLContext sslContext = sslBuilder.build();
> > > 
> > > final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
> > > credentialsProvider.setCredentials(AuthScope.ANY,
> > > new UsernamePasswordCredentials("user", "password"));
> > > 
> > > Header[] defaultHeaders = new Header[] {
> > > new BasicHeader("Authorization", "Basic " + encodeBase64("user:password".getBytes())) };
> > > RestClientBuilder restClientBuilder = RestClient
> > > .builder(new HttpHost("localhost",
> > > Integer.valueOf("9200"), "https"))
> > > .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
> > > @Override
> > > public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
> > > return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
> > > }
> > > });
> > > // .setHttpClientConfigCallback(
> > > // new RestClientBuilder.HttpClientConfigCallback() {
> > > // @Override
> > > // public HttpAsyncClientBuilder customizeHttpClient(
> > > // HttpAsyncClientBuilder httpClientBuilder) {
> > > // httpClientBuilder.setDefaultHeaders(Arrays.asList(defaultHeaders));
> > > // httpClientBuilder.setSSLContext(sslContext);
> > > // return httpClientBuilder;
> > > // }
> > > // }
> > > //
> > > // );
> > > restClientBuilder.setMaxRetryTimeoutMillis(10000);
> > > restClientBuilder.setDefaultHeaders(defaultHeaders);
> > > restClientBuilder.setFailureListener(new RestClient.FailureListener() {
> > > @Override
> > > public void onFailure(HttpHost host) {
> > > LOGGER.error("Couldn't initialize Low Level Rest Client");
> > > System.exit(-1);
> > > }
> > > });
> > > 
> > > ```
> > > 
> > > i am getting IO exception saying with timeouts, there is no error being logged. what is the correct way to achieve this.
> 
> > > - Search Guard and Elasticsearch version
> 
> > > - Installed and used enterprise modules, if any
> 
> > > - JVM version and operating system version
> 
> > > - Search Guard configuration files
> 
> > > - Elasticsearch log messages on debug level
> 
> > > - Other installed Elasticsearch or Kibana plugins, if any
> 
> > –
> > 
> > You received this message because you are subscribed to the Google Groups “Search Guard Community Forum” group.
> > 
> > To unsubscribe from this group and stop receiving emails from it, send an email to [search-guard+unsubscribe@googlegroups.com](mailto:search-guard+unsubscribe@googlegroups.com).
> > 
> > To post to this group, send email to [search-guard@googlegroups.com](mailto:search-guard@googlegroups.com).
> > 
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/search-guard/031e8d6b-2632-46c5-93e8-9d1b09b410eb%40googlegroups.com](https://groups.google.com/d/msgid/search-guard/031e8d6b-2632-46c5-93e8-9d1b09b410eb%40googlegroups.com?utm_medium=email&utm_source=footer).
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![searchguard\_google\_group](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/searchguard_google_group/32/462_2.png) [@searchguard\_google\_group](https://forum.search-guard.com/u/searchguard_google_group)\
**Post date:** [February 3, 2019, 4:18pm UTC](https://forum.search-guard.com/t/couldnt-instantiate-rest-high-level-client-with-ssl-enabled-at-http-layer/659/5 "2019-02-03T16:18:11Z")

</div>

see [https://gist.github.com/floragunncom/e1807599f0fa9c9338ffcb0ac45b27d1](https://gist.github.com/floragunncom/e1807599f0fa9c9338ffcb0ac45b27d1)

> **···**
>
> > Am 25.01.2019 um 14:04 schrieb 秋明本 \<qiumingben@gmail.com\>:
> > 
> > I am using high level rest client, and I am just trying to use the account and password to connect to the cluster. I don't know about certificate verification. You can check the description in this link.  
> > [Accesiblty of index through java code - ReadonlyREST Community](Https://forum.readonlyrest.com/t/accesiblty-of-index-through-java-code/584)
> > 
> > Kasinaat Selvi Sukesh \<kasinaat007@gmail.com\>于2019年1月25日 周五下午6:34写道：  
> > Here you are using java keystore.What should I do if I want to use client certificate authentication?
> > 
> > On Monday, October 30, 2017 at 1:46:02 PM UTC+5:30, Kutty Kumar wrote:  
> > When asking questions, please provide the following information:
> > 
> > Guys i have a cluster which is running with elasticsearch 5.6.2, and it has searchguard plugin enabled, also SSL is enabled for both the transport layer as well as the http layer, when i execute the following curl command from the terminal  
> > `curl -k -u user:password [https://localhost:9200](https://localhost:9200)`, the response is returned and its fine, but when i instantiate a high level rest client using the following code
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public RccRestClient()  
> > &nbsp;&nbsp;&nbsp;&nbsp;throws NodeValidationException, IOException, CertificateException, NoSuchAlgorithmException,  
> > &nbsp;&nbsp;&nbsp;&nbsp;KeyStoreException, KeyManagementException, UnrecoverableKeyException {  
> > &nbsp;&nbsp;&nbsp;&nbsp;SSLContextBuilder sslBuilder = SSLContexts.custom()  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//.loadTrustMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/truststore.jks"),"password".toCharArray());  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.loadKeyMaterial(new File("/Users/kumard/Desktop/elasticsearch-5.6.2/config/0-keystore.jks"),"password".toCharArray(),"password".toCharArray());  
> > &nbsp;&nbsp;&nbsp;&nbsp;final SSLContext sslContext = sslBuilder.build();
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();  
> > &nbsp;&nbsp;&nbsp;&nbsp;credentialsProvider.setCredentials(AuthScope.ANY,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new UsernamePasswordCredentials("user", "password"));
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Header defaultHeaders = new Header {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new BasicHeader("Authorization", "Basic " + encodeBase64("user:password".getBytes())) };  
> > &nbsp;&nbsp;&nbsp;&nbsp;RestClientBuilder restClientBuilder = RestClient  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.builder(new HttpHost("localhost",  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer.valueOf("9200"), "https"))  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@Override  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});  
> > &nbsp;&nbsp;&nbsp;&nbsp;// .setHttpClientConfigCallback(  
> > &nbsp;&nbsp;&nbsp;&nbsp;// new RestClientBuilder.HttpClientConfigCallback() {  
> > &nbsp;&nbsp;&nbsp;&nbsp;// @Override  
> > &nbsp;&nbsp;&nbsp;&nbsp;// public HttpAsyncClientBuilder customizeHttpClient(  
> > &nbsp;&nbsp;&nbsp;&nbsp;// HttpAsyncClientBuilder httpClientBuilder) {  
> > &nbsp;&nbsp;&nbsp;&nbsp;// httpClientBuilder.setDefaultHeaders(Arrays.asList(defaultHeaders));  
> > &nbsp;&nbsp;&nbsp;&nbsp;// httpClientBuilder.setSSLContext(sslContext);  
> > &nbsp;&nbsp;&nbsp;&nbsp;// return httpClientBuilder;  
> > &nbsp;&nbsp;&nbsp;&nbsp;// }  
> > &nbsp;&nbsp;&nbsp;&nbsp;// }  
> > &nbsp;&nbsp;&nbsp;&nbsp;//  
> > &nbsp;&nbsp;&nbsp;&nbsp;// );  
> > &nbsp;&nbsp;&nbsp;&nbsp;restClientBuilder.setMaxRetryTimeoutMillis(10000);  
> > &nbsp;&nbsp;&nbsp;&nbsp;restClientBuilder.setDefaultHeaders(defaultHeaders);  
> > &nbsp;&nbsp;&nbsp;&nbsp;restClientBuilder.setFailureListener(new RestClient.FailureListener() {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@Override  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void onFailure(HttpHost host) {  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOGGER.error("Couldn't initialize Low Level Rest Client");  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.exit(-1);  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;&nbsp;});  
> > i am getting IO exception saying with timeouts, there is no error being logged. what is the correct way to achieve this.
> > 
> > \* Search Guard and Elasticsearch version  
> > \* Installed and used enterprise modules, if any  
> > \* JVM version and operating system version  
> > \* Search Guard configuration files  
> > \* Elasticsearch log messages on debug level  
> > \* Other installed Elasticsearch or Kibana plugins, if any
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "Search Guard Community Forum" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to search-guard+unsubscribe@googlegroups.com.  
> > To post to this group, send email to search-guard@googlegroups.com.  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/search-guard/031e8d6b-2632-46c5-93e8-9d1b09b410eb%40googlegroups.com\](https://groups.google.com/d/msgid/search-guard/031e8d6b-2632-46c5-93e8-9d1b09b410eb%40googlegroups.com%5C).  
> > For more options, visit [https://groups.google.com/d/optout\](https://groups.google.com/d/optout%5C).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "Search Guard Community Forum" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to search-guard+unsubscribe@googlegroups.com.  
> > To post to this group, send email to search-guard@googlegroups.com.  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/search-guard/CADZDP89hscehO6cME%2BKFGhDCEOk91NRz0Pz9zx3Y\_rcY4X\_enQ%40mail.gmail.com\](https://groups.google.com/d/msgid/search-guard/CADZDP89hscehO6cME%2BKFGhDCEOk91NRz0Pz9zx3Y_rcY4X_enQ%40mail.gmail.com%5C).  
> > For more options, visit [https://groups.google.com/d/optout\](https://groups.google.com/d/optout%5C).
