private SslHandler getSslHandler() throws Exception {
// get SslHandler if it was added to the pipeline
ArgumentCaptor<ChannelHandler> captor = ArgumentCaptor.forClass(ChannelHandler.class);
verify(pipeline).addFirst(captor.capture());
SslHandler sslHandler = (SslHandler) captor.getValue();
// mock and store the context so we can get the handshake future
ChannelHandlerContext context = mock(ChannelHandlerContext.class);
when(context.executor()).thenReturn(ImmediateEventExecutor.INSTANCE);
when(context.channel()).thenReturn(mock(Channel.class, Answers.RETURNS_MOCKS.get()));
// add the handler but prevent the handshake from running automatically
when(channel.isActive()).thenReturn(false);
sslHandler.handlerAdded(context);
return sslHandler;
}
SmtpSessionTest.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:NioSmtpClient
作者:
评论列表
文章目录