Java SDK3.1 with TLS connection failing with AmbiguousTimeoutException

I followed the steps mentioned in below link to enable TLS using java sdk3.1 client. But when I enable the TLS getting AmbiguousTimeoutException where as after disabling the TLS it is working fine.
Please help

https://docs.couchbase.com/server/current/manage/manage-security/configure-client-certificates.html

My sample code is like -

ClusterEnvironment.Builder envBuilder = ClusterEnvironment

  •            .builder().ioEnvironment(IoEnvironment.eventLoopThreadCount(10))//iopoolsize --should roughly correlate with the number of cores available to the JVM*
    
  •            .timeoutConfig(TimeoutConfig.connectTimeout(Duration.ofMillis(2500))).*
    
  •            securityConfig(SecurityConfig.enableTls(true).enableHostnameVerification(true).*
    
  •            trustStore((Paths.get("keystore path")), "****", Optional.empty()));*
    

ClusterEnvironment env = envBuilder.build();

  •    Cluster cluster = Cluster.connect("CBSIP,*
              *ClusterOptions.clusterOptions("user_name", "bucket_pwd").*
    
  •                    environment(env));*
    

Bucket pocDataBucket = cluster.bucket(“bucket_name”);

After this trying to save and get the document.

Exception -

Exception in thread “main” com.couchbase.client.core.error.AmbiguousTimeoutException: UpsertRequest, Reason: TIMEOUT {“cancelled”:true,“completed”:true,“coreId”:“0xd23f0900000001”,“idempotent”:false,“reason”:“TIMEOUT”,“requestId”:2,“requestType”:“UpsertRequest”,“retried”:14,“retryReasons”:[“BUCKET_OPEN_IN_PROGRESS”],“service”:{“bucket”:“ptxdata”,“collection”:"_default",“documentId”:“emp_1”,“opaque”:“0x1”,“scope”:"_default",“type”:“kv”},“timeoutMs”:2500,“timings”:{“encodingMicros”:3940,“totalMicros”:2506667}}

  •    at com.couchbase.client.java.AsyncUtils.block(AsyncUtils.java:51)*
    
  •    at com.couchbase.client.java.Collection.upsert(Collection.java:417)*
    
  •    at KnCBSTLSConnectionTest.saveDocument(KnCBSTLSConnectionTest.java:62)*
    
  •    at KnCBSTLSConnectionTest.main(KnCBSTLSConnectionTest.java:52)*
    
  •    Suppressed: java.lang.Exception: The above exception was originally thrown by another thread at the following location.*
    
  •            at com.couchbase.client.core.msg.BaseRequest.cancel(BaseRequest.java:170)*
    
  •            at com.couchbase.client.core.Timer.lambda$register$2(Timer.java:157)*
    
  •            at com.couchbase.client.core.deps.io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:672)*
    
  •            at com.couchbase.client.core.deps.io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:747)*
    
  •            at com.couchbase.client.core.deps.io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:472)*
    
  •            at com.couchbase.client.core.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)*
    
  •            at java.base/java.lang.Thread.run(Thread.java:834)*