use of io.netty.handler.ssl.JdkSslClientContext in project riposte by Nike-Inc.
the class HttpChannelInitializerTest method initChannel_does_not_add_debugLoggingHandler_if_debugChannelLifecycleLoggingEnabled_is_false.
@Test
public void initChannel_does_not_add_debugLoggingHandler_if_debugChannelLifecycleLoggingEnabled_is_false() throws SSLException {
// given
HttpChannelInitializer hci = basicHttpChannelInitializer(new JdkSslClientContext(), 42, 100, false, mock(RequestValidator.class), createRequestAndResponseFilterMock());
// when
hci.initChannel(socketChannelMock);
// then
ArgumentCaptor<ChannelHandler> channelHandlerArgumentCaptor = ArgumentCaptor.forClass(ChannelHandler.class);
verify(channelPipelineMock, atLeastOnce()).addLast(anyString(), channelHandlerArgumentCaptor.capture());
List<ChannelHandler> handlers = channelHandlerArgumentCaptor.getAllValues();
assertThat(findChannelHandler(handlers, LoggingHandler.class), nullValue());
}
use of io.netty.handler.ssl.JdkSslClientContext in project riposte by Nike-Inc.
the class HttpChannelInitializerTest method initChannel_adds_debugLoggingHandler_first_if_debugChannelLifecycleLoggingEnabled_is_true.
@Test
public void initChannel_adds_debugLoggingHandler_first_if_debugChannelLifecycleLoggingEnabled_is_true() throws SSLException {
// given
HttpChannelInitializer hci = basicHttpChannelInitializer(new JdkSslClientContext(), 42, 100, true, mock(RequestValidator.class), createRequestAndResponseFilterMock());
// when
hci.initChannel(socketChannelMock);
// then
ArgumentCaptor<ChannelHandler> channelHandlerArgumentCaptor = ArgumentCaptor.forClass(ChannelHandler.class);
verify(channelPipelineMock, atLeastOnce()).addLast(anyString(), channelHandlerArgumentCaptor.capture());
List<ChannelHandler> handlers = channelHandlerArgumentCaptor.getAllValues();
assertThat(handlers.get(0), instanceOf(LoggingHandler.class));
}
use of io.netty.handler.ssl.JdkSslClientContext in project netty by netty.
the class SocketSslClientRenegotiateTest method data.
public static Collection<Object[]> data() throws Exception {
List<SslContext> serverContexts = new ArrayList<SslContext>();
List<SslContext> clientContexts = new ArrayList<SslContext>();
clientContexts.add(new JdkSslClientContext(CERT_FILE));
boolean hasOpenSsl = OpenSsl.isAvailable();
if (hasOpenSsl) {
OpenSslServerContext context = new OpenSslServerContext(CERT_FILE, KEY_FILE);
serverContexts.add(context);
} else {
logger.warn("OpenSSL is unavailable and thus will not be tested.", OpenSsl.unavailabilityCause());
}
List<Object[]> params = new ArrayList<Object[]>();
for (SslContext sc : serverContexts) {
for (SslContext cc : clientContexts) {
for (int i = 0; i < 32; i++) {
params.add(new Object[] { sc, cc, true });
params.add(new Object[] { sc, cc, false });
}
}
}
return params;
}
Aggregations