@Test public void outboundStreamShouldNotWriteResetFrameOnClose_IfStreamDidntExist() { writer = new Writer() { private boolean headersWritten; @Override void write(Object msg, ChannelPromise promise) { if (!headersWritten && msg instanceof Http2HeadersFrame) { headersWritten = true; Http2HeadersFrame headersFrame = (Http2HeadersFrame) msg; final TestableHttp2MultiplexCodec.Stream stream = (TestableHttp2MultiplexCodec.Stream) headersFrame.stream(); stream.id = 1; promise.setFailure(new Exception("boom")); } else { super.write(msg, promise); } } }; childChannelInitializer.handler = new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers())); ctx.fireChannelActive(); } }; Channel childChannel = newOutboundStream(); assertFalse(childChannel.isActive()); childChannel.close(); parentChannel.runPendingTasks(); assertTrue(parentChannel.outboundMessages().isEmpty()); }
final Http2StreamChannel newOutboundStream() { return new DefaultHttp2StreamChannel(newStream(), true); }
Http2MultiplexCodec extends Http2FrameCodec { final Http2StreamChannel newOutboundStream() { return new DefaultHttp2StreamChannel(newStream(), true); } }
Http2MultiplexCodec extends Http2FrameCodec { final Http2StreamChannel newOutboundStream() { return new DefaultHttp2StreamChannel(newStream(), true); } Http2MultiplexCodec(Http2ConnectionEncoder encoder,
                        Http2ConnectionDecoder decoder,
                        Http2Settings initialSettings,
                        ChannelHandler inboundStreamHandler,
                        ChannelHandler upgradeStreamHandler); }
Http2MultiplexCodec extends Http2FrameCodec { final Http2StreamChannel newOutboundStream() { return new DefaultHttp2StreamChannel(newStream(), true); } Http2MultiplexCodec(Http2ConnectionEncoder encoder,
                        Http2ConnectionDecoder decoder,
                        Http2Settings initialSettings,
                        ChannelHandler inboundStreamHandler,
                        ChannelHandler upgradeStreamHandler); @Override void onHttpClientUpgrade(); @Override final void handlerAdded0(ChannelHandlerContext ctx); @Override final void handlerRemoved0(ChannelHandlerContext ctx); @Override final void channelReadComplete(ChannelHandlerContext ctx); @Override final void channelRead(ChannelHandlerContext ctx, Object msg); }
Http2MultiplexCodec extends Http2FrameCodec { final Http2StreamChannel newOutboundStream() { return new DefaultHttp2StreamChannel(newStream(), true); } Http2MultiplexCodec(Http2ConnectionEncoder encoder,
                        Http2ConnectionDecoder decoder,
                        Http2Settings initialSettings,
                        ChannelHandler inboundStreamHandler,
                        ChannelHandler upgradeStreamHandler); @Override void onHttpClientUpgrade(); @Override final void handlerAdded0(ChannelHandlerContext ctx); @Override final void handlerRemoved0(ChannelHandlerContext ctx); @Override final void channelReadComplete(ChannelHandlerContext ctx); @Override final void channelRead(ChannelHandlerContext ctx, Object msg);  }