Http2FrameRoundtripTest Class — netty Architecture
Architecture documentation for the Http2FrameRoundtripTest class in Http2FrameRoundtripTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 900e14d5_99d5_0a22_aeb4_72af4ffe3fca["Http2FrameRoundtripTest"] 8fb0c6d6_5e15_b263_f624_372dd5cbf651["Http2FrameRoundtripTest.java"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|defined in| 8fb0c6d6_5e15_b263_f624_372dd5cbf651 a7462a66_0006_7ca6_d51d_c99d38165b7b["setup()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| a7462a66_0006_7ca6_d51d_c99d38165b7b 1f17b151_7510_46a5_ace6_1475a418a8c1["teardown()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 1f17b151_7510_46a5_ace6_1475a418a8c1 fd168eb0_da58_e68b_05bb_4ef5b7ced6a4["emptyDataShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| fd168eb0_da58_e68b_05bb_4ef5b7ced6a4 21b8c988_9c97_9e0f_f21d_d9698de367e9["dataShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 21b8c988_9c97_9e0f_f21d_d9698de367e9 ecc7579a_5842_9ae9_bf51_a5803f430296["dataWithPaddingShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| ecc7579a_5842_9ae9_bf51_a5803f430296 243c1c92_d039_1775_0586_dd3e7b77cb19["largeDataFrameShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 243c1c92_d039_1775_0586_dd3e7b77cb19 45467f77_508f_0f47_e93d_d4f53129b6f0["emptyHeadersShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 45467f77_508f_0f47_e93d_d4f53129b6f0 0c6c671e_122c_bb46_b37b_14ca8eb7ac37["emptyHeadersWithPaddingShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 0c6c671e_122c_bb46_b37b_14ca8eb7ac37 2de0852d_f7ab_e8d8_63d4_d50302cd96e1["binaryHeadersWithoutPriorityShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 2de0852d_f7ab_e8d8_63d4_d50302cd96e1 e3cb4f09_4d76_f247_7a37_adb4fca6d047["headersFrameWithoutPriorityShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| e3cb4f09_4d76_f247_7a37_adb4fca6d047 2c95287e_9c2b_8934_7fad_961926e409ba["headersFrameWithPriorityShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 2c95287e_9c2b_8934_7fad_961926e409ba 6dcf2226_18b8_0a50_b347_90c507fe9c92["headersWithPaddingWithoutPriorityShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| 6dcf2226_18b8_0a50_b347_90c507fe9c92 ced6d780_12e4_8a7b_2967_0b07665e09af["headersWithPaddingWithPriorityShouldMatch()"] 900e14d5_99d5_0a22_aeb4_72af4ffe3fca -->|method| ced6d780_12e4_8a7b_2967_0b07665e09af
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2FrameRoundtripTest.java lines 69–491
public class Http2FrameRoundtripTest {
private static final byte[] MESSAGE = "hello world".getBytes(UTF_8);
private static final int STREAM_ID = 0x7FFFFFFF;
private static final int WINDOW_UPDATE = 0x7FFFFFFF;
private static final long ERROR_CODE = 0xFFFFFFFFL;
@Mock
private Http2FrameListener listener;
@Mock
private ChannelHandlerContext ctx;
@Mock
private EventExecutor executor;
@Mock
private Channel channel;
@Mock
private ByteBufAllocator alloc;
private Http2FrameWriter writer;
private Http2FrameReader reader;
private final List<ByteBuf> needReleasing = new LinkedList<ByteBuf>();
@BeforeEach
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
when(ctx.alloc()).thenReturn(alloc);
when(ctx.executor()).thenReturn(executor);
when(ctx.channel()).thenReturn(channel);
doAnswer(new Answer<ByteBuf>() {
@Override
public ByteBuf answer(InvocationOnMock in) throws Throwable {
return Unpooled.buffer();
}
}).when(alloc).buffer();
doAnswer(new Answer<ByteBuf>() {
@Override
public ByteBuf answer(InvocationOnMock in) throws Throwable {
return Unpooled.buffer((Integer) in.getArguments()[0]);
}
}).when(alloc).buffer(anyInt());
doAnswer(new Answer<ChannelPromise>() {
@Override
public ChannelPromise answer(InvocationOnMock invocation) throws Throwable {
return new DefaultChannelPromise(channel, GlobalEventExecutor.INSTANCE);
}
}).when(ctx).newPromise();
writer = new DefaultHttp2FrameWriter(new DefaultHttp2HeadersEncoder(NEVER_SENSITIVE, newTestEncoder()));
reader = new DefaultHttp2FrameReader(new DefaultHttp2HeadersDecoder(false, false, newTestDecoder()));
}
@AfterEach
public void teardown() {
try {
// Release all of the buffers.
for (ByteBuf buf : needReleasing) {
buf.release();
}
// Now verify that all of the reference counts are zero.
for (ByteBuf buf : needReleasing) {
int expectedFinalRefCount = 0;
if (buf.isReadOnly() || buf instanceof EmptyByteBuf) {
// Special case for when we're writing slices of the padding buffer.
expectedFinalRefCount = 1;
}
assertEquals(expectedFinalRefCount, buf.refCnt());
}
} finally {
needReleasing.clear();
}
}
@Test
public void emptyDataShouldMatch() throws Exception {
final ByteBuf data = EMPTY_BUFFER;
writer.writeData(ctx, STREAM_ID, data.slice(), 0, false, ctx.newPromise());
readFrames();
Source
Frequently Asked Questions
What is the Http2FrameRoundtripTest class?
Http2FrameRoundtripTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2FrameRoundtripTest.java.
Where is Http2FrameRoundtripTest defined?
Http2FrameRoundtripTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2FrameRoundtripTest.java at line 69.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free