### Question:
Http2MultiplexCodec extends Http2FrameCodec { final Http2StreamChannel newOutboundStream() { return new DefaultHttp2StreamChannel(newStream()); } Http2MultiplexCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings,
                    ChannelHandler inboundStreamHandler); @Override final void handlerAdded0(ChannelHandlerContext ctx); @Override final void handlerRemoved0(ChannelHandlerContext ctx); @Override final void channelReadComplete(ChannelHandlerContext ctx); @Override final void flush(ChannelHandlerContext ctx);  }### Answer:
@Test public void idleOutboundStreamShouldNotWriteResetFrameOnClose() { childChannelInitializer.handler = new LastInboundHandler(); Channel childChannel = newOutboundStream(); assertTrue(childChannel.isActive()); childChannel.close(); parentChannel.runPendingTasks(); assertFalse(childChannel.isOpen()); assertFalse(childChannel.isActive()); assertNull(parentChannel.readOutbound()); }
@Test public void outboundStreamShouldWriteResetFrameOnClose_headersSent() { childChannelInitializer.handler = new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers())); ctx.fireChannelActive(); } }; Channel childChannel = newOutboundStream(); assertTrue(childChannel.isActive()); Http2FrameStream stream2 = readOutboundHeadersAndAssignId(); childChannel.close(); parentChannel.runPendingTasks(); Http2ResetFrame reset = parentChannel.readOutbound(); assertEquals(stream2, reset.stream()); assertEquals(Http2Error.CANCEL.code(), reset.errorCode()); }
@Test public void settingChannelOptsAndAttrs() { AttributeKey<String> key = AttributeKey.newInstance("foo"); Channel childChannel = newOutboundStream(); childChannel.config().setAutoRead(false).setWriteSpinCount(1000); childChannel.attr(key).set("bar"); assertFalse(childChannel.config().isAutoRead()); assertEquals(1000, childChannel.config().getWriteSpinCount()); assertEquals("bar", childChannel.attr(key).get()); }