QuicChannelEchoTest Class — netty Architecture
Architecture documentation for the QuicChannelEchoTest class in QuicChannelEchoTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 949dbf36_222b_a1d5_95aa_68ae528fcaf5["QuicChannelEchoTest"] 4b2da30c_3898_7e2f_23f4_62545543f3c8["QuicChannelEchoTest.java"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|defined in| 4b2da30c_3898_7e2f_23f4_62545543f3c8 494322ca_c997_6257_b077_d4416b8c5277["data()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| 494322ca_c997_6257_b077_d4416b8c5277 e3494b32_ba2d_9829_4946_ef33056b5189["setAllocator()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| e3494b32_ba2d_9829_4946_ef33056b5189 65e9b173_6f62_0379_ba24_96242023fcee["ByteBufAllocator()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| 65e9b173_6f62_0379_ba24_96242023fcee b6b62dd4_732e_55a3_c880_96407c90f51b["testEchoStartedFromServer()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| b6b62dd4_732e_55a3_c880_96407c90f51b 517fed06_cd16_bd40_97ea_e48339ad0706["testEchoStartedFromClient()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| 517fed06_cd16_bd40_97ea_e48339ad0706 39d53d07_1929_f59b_be60_a52cbdc52542["writeAllData()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| 39d53d07_1929_f59b_be60_a52cbdc52542 b05ab098_a6d5_f522_4cfc_e7b527ff5c1b["waitForData()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| b05ab098_a6d5_f522_4cfc_e7b527ff5c1b d03da1b0_2a83_47ce_bc9b_48796be3e619["checkForException()"] 949dbf36_222b_a1d5_95aa_68ae528fcaf5 -->|method| d03da1b0_2a83_47ce_bc9b_48796be3e619
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelEchoTest.java lines 49–440
public class QuicChannelEchoTest extends AbstractQuicTest {
private static final Random random = new Random();
static final byte[] data = new byte[1048576];
static {
random.nextBytes(data);
}
public static Collection<Object[]> data() {
List<Object[]> config = new ArrayList<>();
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
for (int c = 0; c < 2; c++) {
config.add(new Object[] { a == 0, b == 0, c == 0 });
}
}
}
return config;
}
private void setAllocator(Channel channel, ByteBufAllocator allocator) {
channel.config().setAllocator(allocator);
}
private ByteBufAllocator getAllocator(boolean directBuffer) {
if (directBuffer) {
return new UnpooledByteBufAllocator(true);
} else {
// Force usage of heap buffers and also ensure memoryAddress() is not not supported.
return new AbstractByteBufAllocator(false) {
@Override
public ByteBuf ioBuffer() {
return heapBuffer();
}
@Override
public ByteBuf ioBuffer(int initialCapacity) {
return heapBuffer(initialCapacity);
}
@Override
public ByteBuf ioBuffer(int initialCapacity, int maxCapacity) {
return heapBuffer(initialCapacity, maxCapacity);
}
@Override
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity) {
return new UnpooledHeapByteBuf(this, initialCapacity, maxCapacity);
}
@Override
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity) {
return new UnpooledDirectByteBuf(this, initialCapacity, maxCapacity);
}
@Override
public boolean isDirectBufferPooled() {
return false;
}
};
}
}
@ParameterizedTest(name =
"{index}: autoRead = {0}, directBuffer = {1}, composite = {2}")
@MethodSource("data")
public void testEchoStartedFromServer(boolean autoRead, boolean directBuffer, boolean composite) throws Throwable {
ByteBufAllocator allocator = getAllocator(directBuffer);
final EchoHandler sh = new EchoHandler(true, autoRead, allocator);
final EchoHandler ch = new EchoHandler(false, autoRead, allocator);
AtomicReference<List<ChannelFuture>> writeFutures = new AtomicReference<>();
Channel server = QuicTestUtils.newServer(ImmediateExecutor.INSTANCE, new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) {
setAllocator(ctx.channel(), allocator);
((QuicChannel) ctx.channel()).createStream(QuicStreamType.BIDIRECTIONAL, sh)
.addListener((Future<QuicStreamChannel> future) -> {
QuicStreamChannel stream = future.getNow();
setAllocator(stream, allocator);
Source
Frequently Asked Questions
What is the QuicChannelEchoTest class?
QuicChannelEchoTest is a class in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelEchoTest.java.
Where is QuicChannelEchoTest defined?
QuicChannelEchoTest is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelEchoTest.java at line 49.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free