io.netty.handler.ssl.SslCloseCompletionEvent Java Examples
The following examples show how to use
io.netty.handler.ssl.SslCloseCompletionEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpServerHandler.java From armeria with Apache License 2.0 | 6 votes |
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof SslHandshakeCompletionEvent) { final SslHandler sslHandler = ctx.channel().pipeline().get(SslHandler.class); sslSession = sslHandler != null ? sslHandler.engine().getSession() : null; return; } if (evt instanceof SslCloseCompletionEvent || evt instanceof ChannelInputShutdownReadComplete) { // Expected events return; } logger.warn("{} Unexpected user event: {}", ctx.channel(), evt); }
Example #2
Source File: SslCloseCompletionEventHandler.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * Close the channel if the event is {@link SslCloseCompletionEvent} and the channel is unused. * If the channel is being used, it will be closed in {@link ResponseHandler} * */ @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { boolean channelInUse = getAttribute(ctx.channel(), ChannelAttributeKey.IN_USE).orElse(false); if (!channelInUse && evt instanceof SslCloseCompletionEvent) { ctx.close(); } else { ctx.fireUserEventTriggered(evt); } }
Example #3
Source File: SslCloseCompletionEventHandlerTest.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
@Test public void userEventTriggeredUnusedChannel_ClosesChannel() { SslCloseCompletionEventHandler handler = SslCloseCompletionEventHandler.getInstance(); handler.userEventTriggered(ctx, new SslCloseCompletionEvent(new ClosedChannelException())); verify(ctx).close(); }
Example #4
Source File: SslCloseCompletionEventHandlerTest.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
@Test public void userEventTriggered_StaticVariable_ClosesChannel() { SslCloseCompletionEventHandler handler = SslCloseCompletionEventHandler.getInstance(); handler.userEventTriggered(ctx, SslCloseCompletionEvent.SUCCESS); verify(ctx).close(); }
Example #5
Source File: SslCloseCompletionEventHandlerTest.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
@Test public void userEventTriggered_channelInUse_shouldForwardEvent() { SslCloseCompletionEventHandler handler = SslCloseCompletionEventHandler.getInstance(); channel.attr(IN_USE).set(true); SslCloseCompletionEvent event = new SslCloseCompletionEvent(new ClosedChannelException()); handler.userEventTriggered(ctx, event); verify(ctx).fireUserEventTriggered(event); }