use of javax.net.ssl.SSLParameters in project rest.li by linkedin.
the class TestHttpNettyStreamClient method testClientPipelineFactory2Pass.
// Test that can set cipher suites in SSLParameters that have at least one match in
// SSLContext.
// This in fact tests HttpClientPipelineFactory constructor through HttpNettyClient
// constructor.
@Test
public void testClientPipelineFactory2Pass() throws NoSuchAlgorithmException {
String[] requestedCipherSuites = { "Unsupported", "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA" };
SSLParameters sslParameters = new SSLParameters();
sslParameters.setCipherSuites(requestedCipherSuites);
new HttpClientBuilder(_eventLoop, _scheduler).setSSLContext(SSLContext.getDefault()).setSSLParameters(sslParameters).buildStream();
}
use of javax.net.ssl.SSLParameters in project rest.li by linkedin.
the class TestHttpNettyClient method testClientPipelineFactory2Pass.
// Test that can set cipher suites in SSLParameters that have at least one match in
// SSLContext.
// This in fact tests HttpClientPipelineFactory constructor through HttpNettyClient
// constructor.
@Test
public void testClientPipelineFactory2Pass() throws NoSuchAlgorithmException {
String[] requestedCipherSuites = { "Unsupported", "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA" };
SSLParameters sslParameters = new SSLParameters();
sslParameters.setCipherSuites(requestedCipherSuites);
new HttpClientBuilder(_eventLoop, _scheduler).setSSLContext(SSLContext.getDefault()).setSSLParameters(sslParameters).buildRest();
}
use of javax.net.ssl.SSLParameters in project rest.li by linkedin.
the class TestHttpNettyClient method testClientPipelineFactory2Fail.
// Test that cannot set cipher suites in SSLParameters that don't have any match in
// SSLContext.
// This in fact tests HttpClientPipelineFactory constructor through HttpNettyClient
// constructor.
@Test
public void testClientPipelineFactory2Fail() throws NoSuchAlgorithmException {
String[] requestedCipherSuites = { "Unsupported" };
SSLParameters sslParameters = new SSLParameters();
sslParameters.setCipherSuites(requestedCipherSuites);
try {
new HttpClientBuilder(_eventLoop, _scheduler).setSSLContext(SSLContext.getDefault()).setSSLParameters(sslParameters).buildRest();
} catch (IllegalArgumentException e) {
// Check exception message to make sure it's the expected one.
Assert.assertEquals(e.getMessage(), "None of the requested cipher suites: [Unsupported] are found in SSLContext");
}
}
use of javax.net.ssl.SSLParameters in project rest.li by linkedin.
the class TestHttpNettyClient method testClientPipelineFactory3Fail.
// Test that cannot set protocols in SSLParameters that don't have any match in
// SSLContext.
// This in fact tests HttpClientPipelineFactory constructor through HttpNettyClient
// constructor.
@Test
public void testClientPipelineFactory3Fail() throws NoSuchAlgorithmException {
String[] requestedProtocols = { "Unsupported" };
SSLParameters sslParameters = new SSLParameters();
sslParameters.setProtocols(requestedProtocols);
try {
new HttpClientBuilder(_eventLoop, _scheduler).setSSLContext(SSLContext.getDefault()).setSSLParameters(sslParameters).buildRest();
} catch (IllegalArgumentException e) {
// Check exception message to make sure it's the expected one.
Assert.assertEquals(e.getMessage(), "None of the requested protocols: [Unsupported] are found in SSLContext");
}
}
use of javax.net.ssl.SSLParameters in project rest.li by linkedin.
the class TestHttpNettyClient method testClientPipelineFactory3Pass.
// Test that can set protocols in SSLParameters that have at least one match in
// SSLContext.
// This in fact tests HttpClientPipelineFactory constructor through HttpNettyClient
// constructor.
@Test
public void testClientPipelineFactory3Pass() throws NoSuchAlgorithmException {
String[] requestedProtocols = { "Unsupported", "TLSv1" };
SSLParameters sslParameters = new SSLParameters();
sslParameters.setProtocols(requestedProtocols);
new HttpClientBuilder(_eventLoop, _scheduler).setSSLContext(SSLContext.getDefault()).setSSLParameters(sslParameters).buildRest();
}
Aggregations