AbstractSessionNettyHandler extends AbstractNettyHandler { @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { logger.info("[channelInactive]"); if(session != null && session.getSessionState() != null && !session.getSessionState().equals(new SessionClosed(session))) { try { session.release(); } catch (Exception e) { logger.error("[channelInactive]", e); } } }  @Override void channelInactive(ChannelHandlerContext ctx); @Override void exceptionCaught(ChannelHandlerContext ctx, Throwable cause); @Override void channelWritabilityChanged(ChannelHandlerContext ctx);  }
@Test public void channelInactive() { EmbeddedChannel channel = new EmbeddedChannel(handler); channel.finish(); Assert.assertFalse(channel.isActive()); }