@Test public void testChannelActive() throws Exception { ChannelHandlerContext ctx = getContext(); List<SxpDomain> domains = new ArrayList<>(); when(sxpNode.getDomains()).thenReturn(domains); when(sxpNode.getConnection(any(SocketAddress.class))).thenReturn(null); domains.add(getDomain(mock(SxpConnectionTemplateFields.class))); decoder.channelActive(ctx); verify(ctx, never()).fireChannelActive(); domains.clear(); domains.add(getDomain(null)); decoder.channelActive(ctx); verify(ctx).fireChannelActive(); when(sxpNode.getConnection(any(SocketAddress.class))).thenReturn(mock(SxpConnection.class)); decoder.channelActive(ctx); verify(ctx, times(2)).fireChannelActive(); }
@Override public void channelActive(ChannelHandlerContext ctx) throws SocketAddressNotRecognizedException { InetSocketAddress address = getAddress(ctx); final SxpConnection connection = owner.getConnection(address); final SxpDomain domain = getTemplateDomain(address); if (connection != null || domain == null) { ctx.fireChannelActive(); } }
ConnectionDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void channelActive(ChannelHandlerContext ctx) throws SocketAddressNotRecognizedException { InetSocketAddress address = getAddress(ctx); final SxpConnection connection = owner.getConnection(address); final SxpDomain domain = getTemplateDomain(address); if (connection != null || domain == null) { ctx.fireChannelActive(); } } }
ConnectionDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void channelActive(ChannelHandlerContext ctx) throws SocketAddressNotRecognizedException { InetSocketAddress address = getAddress(ctx); final SxpConnection connection = owner.getConnection(address); final SxpDomain domain = getTemplateDomain(address); if (connection != null || domain == null) { ctx.fireChannelActive(); } } ConnectionDecoder(SxpNode owner); }
ConnectionDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void channelActive(ChannelHandlerContext ctx) throws SocketAddressNotRecognizedException { InetSocketAddress address = getAddress(ctx); final SxpConnection connection = owner.getConnection(address); final SxpDomain domain = getTemplateDomain(address); if (connection != null || domain == null) { ctx.fireChannelActive(); } } ConnectionDecoder(SxpNode owner); @Override void channelActive(ChannelHandlerContext ctx); @Override void channelRead0(ChannelHandlerContext ctx, ByteBuf message); }
ConnectionDecoder extends SimpleChannelInboundHandler<ByteBuf> { @Override public void channelActive(ChannelHandlerContext ctx) throws SocketAddressNotRecognizedException { InetSocketAddress address = getAddress(ctx); final SxpConnection connection = owner.getConnection(address); final SxpDomain domain = getTemplateDomain(address); if (connection != null || domain == null) { ctx.fireChannelActive(); } } ConnectionDecoder(SxpNode owner); @Override void channelActive(ChannelHandlerContext ctx); @Override void channelRead0(ChannelHandlerContext ctx, ByteBuf message);  }