testComplete();
}
@Test
public void testCopyClientOptions() {
HttpClientOptions options = new HttpClientOptions();
int sendBufferSize = TestUtils.randomPositiveInt();
int receiverBufferSize = TestUtils.randomPortInt();
Random rand = new Random();
boolean reuseAddress = rand.nextBoolean();
int trafficClass = TestUtils.randomByte() + 128;
boolean tcpNoDelay = rand.nextBoolean();
boolean tcpKeepAlive = rand.nextBoolean();
int soLinger = TestUtils.randomPositiveInt();
boolean usePooledBuffers = rand.nextBoolean();
int idleTimeout = TestUtils.randomPositiveInt();
boolean ssl = rand.nextBoolean();
JKSOptions keyStoreOptions = new JKSOptions();
String ksPassword = TestUtils.randomAlphaString(100);
keyStoreOptions.setPassword(ksPassword);
JKSOptions trustStoreOptions = new JKSOptions();
String tsPassword = TestUtils.randomAlphaString(100);
trustStoreOptions.setPassword(tsPassword);
String enabledCipher = TestUtils.randomAlphaString(100);
int connectTimeout = TestUtils.randomPositiveInt();
boolean trustAll = rand.nextBoolean();
String crlPath = TestUtils.randomUnicodeString(100);
Buffer crlValue = TestUtils.randomBuffer(100);
boolean verifyHost = rand.nextBoolean();
int maxPoolSize = TestUtils.randomPositiveInt();
boolean keepAlive = rand.nextBoolean();
boolean pipelining = rand.nextBoolean();
boolean tryUseCompression = rand.nextBoolean();
options.setSendBufferSize(sendBufferSize);
options.setReceiveBufferSize(receiverBufferSize);
options.setReuseAddress(reuseAddress);
options.setTrafficClass(trafficClass);
options.setSsl(ssl);
options.setTcpNoDelay(tcpNoDelay);
options.setTcpKeepAlive(tcpKeepAlive);
options.setSoLinger(soLinger);
options.setUsePooledBuffers(usePooledBuffers);
options.setIdleTimeout(idleTimeout);
options.setKeyStoreOptions(keyStoreOptions);
options.setTrustStoreOptions(trustStoreOptions);
options.addEnabledCipherSuite(enabledCipher);
options.setConnectTimeout(connectTimeout);
options.setTrustAll(trustAll);
options.addCrlPath(crlPath);
options.addCrlValue(crlValue);
options.setVerifyHost(verifyHost);
options.setMaxPoolSize(maxPoolSize);
options.setKeepAlive(keepAlive);
options.setPipelining(pipelining);
options.setTryUseCompression(tryUseCompression);
HttpClientOptions copy = new HttpClientOptions(options);
assertEquals(sendBufferSize, copy.getSendBufferSize());
assertEquals(receiverBufferSize, copy.getReceiveBufferSize());
assertEquals(reuseAddress, copy.isReuseAddress());
assertEquals(trafficClass, copy.getTrafficClass());
assertEquals(tcpNoDelay, copy.isTcpNoDelay());
assertEquals(tcpKeepAlive, copy.isTcpKeepAlive());
assertEquals(soLinger, copy.getSoLinger());
assertEquals(usePooledBuffers, copy.isUsePooledBuffers());
assertEquals(idleTimeout, copy.getIdleTimeout());
assertEquals(ssl, copy.isSsl());
assertNotSame(keyStoreOptions, copy.getKeyStoreOptions());
assertEquals(ksPassword, ((JKSOptions) copy.getKeyStoreOptions()).getPassword());
assertNotSame(trustStoreOptions, copy.getTrustStoreOptions());
assertEquals(tsPassword, ((JKSOptions)copy.getTrustStoreOptions()).getPassword());
assertEquals(1, copy.getEnabledCipherSuites().size());
assertTrue(copy.getEnabledCipherSuites().contains(enabledCipher));
assertEquals(connectTimeout, copy.getConnectTimeout());
assertEquals(trustAll, copy.isTrustAll());
assertEquals(1, copy.getCrlPaths().size());
assertEquals(crlPath, copy.getCrlPaths().get(0));
assertEquals(1, copy.getCrlValues().size());
assertEquals(crlValue, copy.getCrlValues().get(0));
assertEquals(verifyHost, copy.isVerifyHost());
assertEquals(maxPoolSize, copy.getMaxPoolSize());
assertEquals(keepAlive, copy.isKeepAlive());
assertEquals(pipelining, copy.isPipelining());
assertEquals(tryUseCompression, copy.isTryUseCompression());
}