testShutdownOutputClosureByServerCausesStreamReset() — netty Function Reference
Architecture documentation for the testShutdownOutputClosureByServerCausesStreamReset() function in QuicStreamShutdownTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 55d4b288_c1b1_40e0_6744_84b389a552a5["testShutdownOutputClosureByServerCausesStreamReset()"] 8f0deefd_ac73_09cd_1ee0_413b4ec84595["QuicStreamShutdownTest"] 55d4b288_c1b1_40e0_6744_84b389a552a5 -->|defined in| 8f0deefd_ac73_09cd_1ee0_413b4ec84595 style 55d4b288_c1b1_40e0_6744_84b389a552a5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicStreamShutdownTest.java lines 155–219
@ParameterizedTest
@MethodSource("newSslTaskExecutors")
public void testShutdownOutputClosureByServerCausesStreamReset(Executor executor) throws Throwable {
Channel server = null;
Channel channel = null;
CountDownLatch latch = new CountDownLatch(2);
AtomicReference<Throwable> errorRef = new AtomicReference<>();
AtomicLong applicationErrorCode = new AtomicLong(-1);
try {
server = QuicTestUtils.newServer(executor, new ChannelInboundHandlerAdapter(),
new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
QuicStreamChannel streamChannel = (QuicStreamChannel) ctx.channel();
ByteBuf buffer = (ByteBuf) msg;
buffer.release();
streamChannel.shutdownOutput(100)
.addListener(f -> {
if (!f.isSuccess()) {
errorRef.compareAndSet(null, f.cause());
}
latch.countDown();
});
}
});
channel = QuicTestUtils.newClient(executor);
QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
.handler(new ChannelInboundHandlerAdapter())
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(server.localAddress())
.connect()
.get();
QuicStreamChannel streamChannel = quicChannel.createStream(QuicStreamType.BIDIRECTIONAL,
new ChannelInboundHandlerAdapter() {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (cause instanceof QuicStreamResetException) {
QuicStreamResetException reset = (QuicStreamResetException) cause;
applicationErrorCode.set(reset.applicationProtocolCode());
} else {
errorRef.set(cause);
}
latch.countDown();
}
}).sync().getNow();
streamChannel.writeAndFlush(Unpooled.buffer().writeInt(4)).sync();
if (!latch.await(5, TimeUnit.SECONDS)) {
fail("Timeout while waiting for completion", errorRef.get());
}
Throwable error = errorRef.get();
if (error != null) {
fail("Failure during execution", error);
}
assertEquals(100, applicationErrorCode.get());
} finally {
QuicTestUtils.closeIfNotNull(channel);
QuicTestUtils.closeIfNotNull(server);
shutdown(executor);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testShutdownOutputClosureByServerCausesStreamReset() do?
testShutdownOutputClosureByServerCausesStreamReset() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicStreamShutdownTest.java.
Where is testShutdownOutputClosureByServerCausesStreamReset() defined?
testShutdownOutputClosureByServerCausesStreamReset() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicStreamShutdownTest.java at line 155.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free