.put("maxPoolSize", maxPoolSize)
.put("keepAlive", keepAlive)
.put("pipelining", pipelining)
.put("tryUseCompression", tryUseCompression);
HttpClientOptions options = new HttpClientOptions(json);
assertEquals(sendBufferSize, options.getSendBufferSize());
assertEquals(receiverBufferSize, options.getReceiveBufferSize());
assertEquals(reuseAddress, options.isReuseAddress());
assertEquals(trafficClass, options.getTrafficClass());
assertEquals(tcpKeepAlive, options.isTcpKeepAlive());
assertEquals(tcpNoDelay, options.isTcpNoDelay());
assertEquals(soLinger, options.getSoLinger());
assertEquals(usePooledBuffers, options.isUsePooledBuffers());
assertEquals(idleTimeout, options.getIdleTimeout());
assertEquals(ssl, options.isSsl());
assertNotSame(keyStoreOptions, options.getKeyStoreOptions());
assertEquals(ksPassword, ((JKSOptions) options.getKeyStoreOptions()).getPassword());
assertEquals(ksPath, ((JKSOptions) options.getKeyStoreOptions()).getPath());
assertNotSame(trustStoreOptions, options.getTrustStoreOptions());
assertEquals(tsPassword, ((JKSOptions) options.getTrustStoreOptions()).getPassword());
assertEquals(tsPath, ((JKSOptions) options.getTrustStoreOptions()).getPath());
assertEquals(1, options.getEnabledCipherSuites().size());
assertTrue(options.getEnabledCipherSuites().contains(enabledCipher));
assertEquals(connectTimeout, options.getConnectTimeout());
assertEquals(trustAll, options.isTrustAll());
assertEquals(1, options.getCrlPaths().size());
assertEquals(crlPath, options.getCrlPaths().get(0));
assertEquals(verifyHost, options.isVerifyHost());
assertEquals(maxPoolSize, options.getMaxPoolSize());
assertEquals(keepAlive, options.isKeepAlive());
assertEquals(pipelining, options.isPipelining());
assertEquals(tryUseCompression, options.isTryUseCompression());
// Test other keystore/truststore types
json.put("keyStoreOptions", new JsonObject().put("type", "pkcs12").put("password", ksPassword))
.put("trustStoreOptions", new JsonObject().put("type", "pkcs12").put("password", tsPassword));
options = new HttpClientOptions(json);
assertTrue(options.getTrustStoreOptions() instanceof PKCS12Options);
assertTrue(options.getKeyStoreOptions() instanceof PKCS12Options);
json.put("keyStoreOptions", new JsonObject().put("type", "keyCert"))
.put("trustStoreOptions", new JsonObject().put("type", "ca"));
options = new HttpClientOptions(json);
assertTrue(options.getTrustStoreOptions() instanceof CaOptions);
assertTrue(options.getKeyStoreOptions() instanceof KeyCertOptions);
// Invalid types
json.put("keyStoreOptions", new JsonObject().put("type", "foo"));
assertIllegalArgumentException(() -> new HttpClientOptions(json));
json.put("trustStoreOptions", new JsonObject().put("type", "foo"));
assertIllegalArgumentException(() -> new HttpClientOptions(json));
}