@Test public void testIOExceptionCaught() throws Exception { decoder.exceptionCaught(channelHandlerContext, new IOException("error")); verify(connection).setStateOff(eq(channelHandlerContext)); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { final SxpConnection connection = owner.getConnection(ctx.channel().remoteAddress()); if (connection == null) { LOG.warn(getLogMessage(owner, ctx, "Channel exception")); return; } if (cause instanceof DecoderException) { if (cause.getCause() instanceof SSLHandshakeException) { LOG.warn("{} SSL invalid certificate {}", connection, cause.getCause().getMessage()); } else if (cause.getCause() instanceof SSLException) { LOG.error("{} SSLException caught, shutting down", connection, cause); } else { LOG.warn("{} Decoder error {} shutting down", connection, cause); } connection.setStateOff(ctx); return; } if (cause instanceof IOException) { LOG.debug("IO error {} shutting down connection {}", cause, connection); connection.setStateOff(ctx); return; } connection.getContext().executeExceptionCaughtStrategy(ctx, connection); LOG.warn(getLogMessage(owner, ctx, "Channel exception"), cause); }
MessageDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { final SxpConnection connection = owner.getConnection(ctx.channel().remoteAddress()); if (connection == null) { LOG.warn(getLogMessage(owner, ctx, "Channel exception")); return; } if (cause instanceof DecoderException) { if (cause.getCause() instanceof SSLHandshakeException) { LOG.warn("{} SSL invalid certificate {}", connection, cause.getCause().getMessage()); } else if (cause.getCause() instanceof SSLException) { LOG.error("{} SSLException caught, shutting down", connection, cause); } else { LOG.warn("{} Decoder error {} shutting down", connection, cause); } connection.setStateOff(ctx); return; } if (cause instanceof IOException) { LOG.debug("IO error {} shutting down connection {}", cause, connection); connection.setStateOff(ctx); return; } connection.getContext().executeExceptionCaughtStrategy(ctx, connection); LOG.warn(getLogMessage(owner, ctx, "Channel exception"), cause); } }
MessageDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { final SxpConnection connection = owner.getConnection(ctx.channel().remoteAddress()); if (connection == null) { LOG.warn(getLogMessage(owner, ctx, "Channel exception")); return; } if (cause instanceof DecoderException) { if (cause.getCause() instanceof SSLHandshakeException) { LOG.warn("{} SSL invalid certificate {}", connection, cause.getCause().getMessage()); } else if (cause.getCause() instanceof SSLException) { LOG.error("{} SSLException caught, shutting down", connection, cause); } else { LOG.warn("{} Decoder error {} shutting down", connection, cause); } connection.setStateOff(ctx); return; } if (cause instanceof IOException) { LOG.debug("IO error {} shutting down connection {}", cause, connection); connection.setStateOff(ctx); return; } connection.getContext().executeExceptionCaughtStrategy(ctx, connection); LOG.warn(getLogMessage(owner, ctx, "Channel exception"), cause); } private  MessageDecoder(SxpNode owner, Profile profile); }
MessageDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { final SxpConnection connection = owner.getConnection(ctx.channel().remoteAddress()); if (connection == null) { LOG.warn(getLogMessage(owner, ctx, "Channel exception")); return; } if (cause instanceof DecoderException) { if (cause.getCause() instanceof SSLHandshakeException) { LOG.warn("{} SSL invalid certificate {}", connection, cause.getCause().getMessage()); } else if (cause.getCause() instanceof SSLException) { LOG.error("{} SSLException caught, shutting down", connection, cause); } else { LOG.warn("{} Decoder error {} shutting down", connection, cause); } connection.setStateOff(ctx); return; } if (cause instanceof IOException) { LOG.debug("IO error {} shutting down connection {}", cause, connection); connection.setStateOff(ctx); return; } connection.getContext().executeExceptionCaughtStrategy(ctx, connection); LOG.warn(getLogMessage(owner, ctx, "Channel exception"), cause); } private  MessageDecoder(SxpNode owner, Profile profile); static ChannelInboundHandler createClientProfile(SxpNode owner); static ChannelInboundHandler createServerProfile(SxpNode owner); static void sendErrorMessage(ChannelHandlerContext ctx, ErrorMessageException messageValidationException,
            SxpConnection connection); @Override void channelActive(ChannelHandlerContext ctx); @Override void channelInactive(ChannelHandlerContext ctx); @Override void channelRead0(ChannelHandlerContext ctx, ByteBuf message); @Override void channelReadComplete(ChannelHandlerContext ctx); @Override void exceptionCaught(ChannelHandlerContext ctx, Throwable cause); }
MessageDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { final SxpConnection connection = owner.getConnection(ctx.channel().remoteAddress()); if (connection == null) { LOG.warn(getLogMessage(owner, ctx, "Channel exception")); return; } if (cause instanceof DecoderException) { if (cause.getCause() instanceof SSLHandshakeException) { LOG.warn("{} SSL invalid certificate {}", connection, cause.getCause().getMessage()); } else if (cause.getCause() instanceof SSLException) { LOG.error("{} SSLException caught, shutting down", connection, cause); } else { LOG.warn("{} Decoder error {} shutting down", connection, cause); } connection.setStateOff(ctx); return; } if (cause instanceof IOException) { LOG.debug("IO error {} shutting down connection {}", cause, connection); connection.setStateOff(ctx); return; } connection.getContext().executeExceptionCaughtStrategy(ctx, connection); LOG.warn(getLogMessage(owner, ctx, "Channel exception"), cause); } private  MessageDecoder(SxpNode owner, Profile profile); static ChannelInboundHandler createClientProfile(SxpNode owner); static ChannelInboundHandler createServerProfile(SxpNode owner); static void sendErrorMessage(ChannelHandlerContext ctx, ErrorMessageException messageValidationException,
            SxpConnection connection); @Override void channelActive(ChannelHandlerContext ctx); @Override void channelInactive(ChannelHandlerContext ctx); @Override void channelRead0(ChannelHandlerContext ctx, ByteBuf message); @Override void channelReadComplete(ChannelHandlerContext ctx); @Override void exceptionCaught(ChannelHandlerContext ctx, Throwable cause);  }