encodeViolatesMaxHeaderListSizeCanStillUseConnection() — netty Function Reference
Architecture documentation for the encodeViolatesMaxHeaderListSizeCanStillUseConnection() function in Http2ConnectionRoundtripTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e115b447_6cad_967b_30a3_5a0da892beed["encodeViolatesMaxHeaderListSizeCanStillUseConnection()"] 0d6189e8_c033_39ff_d087_9019351440fe["Http2ConnectionRoundtripTest"] e115b447_6cad_967b_30a3_5a0da892beed -->|defined in| 0d6189e8_c033_39ff_d087_9019351440fe 1dd685b8_9b56_5b35_70ca_7f2bf9016254["bootstrapEnv()"] e115b447_6cad_967b_30a3_5a0da892beed -->|calls| 1dd685b8_9b56_5b35_70ca_7f2bf9016254 style e115b447_6cad_967b_30a3_5a0da892beed fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java lines 232–350
@Test
public void encodeViolatesMaxHeaderListSizeCanStillUseConnection() throws Exception {
final CountDownLatch serverSettingsAckLatch1 = new CountDownLatch(2);
final CountDownLatch serverSettingsAckLatch2 = new CountDownLatch(3);
final CountDownLatch clientSettingsLatch1 = new CountDownLatch(3);
final CountDownLatch serverRevHeadersLatch = new CountDownLatch(1);
final CountDownLatch clientHeadersLatch = new CountDownLatch(1);
final CountDownLatch clientDataWrite = new CountDownLatch(1);
final AtomicReference<Throwable> clientHeadersWriteException = new AtomicReference<Throwable>();
final AtomicReference<Throwable> clientHeadersWriteException2 = new AtomicReference<Throwable>();
final AtomicReference<Throwable> clientDataWriteException = new AtomicReference<Throwable>();
final Http2Headers headers = dummyHeaders();
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
serverSettingsAckLatch1.countDown();
serverSettingsAckLatch2.countDown();
return null;
}
}).when(serverListener).onSettingsAckRead(any(ChannelHandlerContext.class));
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
clientSettingsLatch1.countDown();
return null;
}
}).when(clientListener).onSettingsRead(any(ChannelHandlerContext.class), any(Http2Settings.class));
// Manually add a listener for when we receive the expected headers on the server.
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
serverRevHeadersLatch.countDown();
return null;
}
}).when(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(5), eq(headers),
anyInt(), anyShort(), anyBoolean(), eq(0), eq(true));
bootstrapEnv(1, 2, 2, 0, 0);
// Set the maxHeaderListSize to 100 so we may be able to write some headers, but not all. We want to verify
// that we don't corrupt state if some can be written but not all.
runInChannel(serverConnectedChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Server.encoder().writeSettings(serverCtx(),
new Http2Settings().copyFrom(http2Server.decoder().localSettings())
.maxHeaderListSize(100),
serverNewPromise());
http2Server.flush(serverCtx());
}
});
assertTrue(serverSettingsAckLatch1.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
runInChannel(clientChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Client.encoder().writeHeaders(ctx(), 3, headers, 0, false, newPromise())
.addListener(future -> clientHeadersWriteException.set(future.cause()));
// It is expected that this write should fail locally and the remote peer will never see this.
http2Client.encoder().writeData(ctx(), 3, Unpooled.buffer(), 0, true, newPromise())
.addListener(future -> {
clientDataWriteException.set(future.cause());
clientDataWrite.countDown();
});
http2Client.flush(ctx());
}
});
assertTrue(clientDataWrite.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
assertNotNull(clientHeadersWriteException.get(), "Header encode should have exceeded maxHeaderListSize!");
assertNotNull(clientDataWriteException.get(), "Data on closed stream should fail!");
// Set the maxHeaderListSize to the max value so we can send the headers.
runInChannel(serverConnectedChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Server.encoder().writeSettings(serverCtx(),
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does encodeViolatesMaxHeaderListSizeCanStillUseConnection() do?
encodeViolatesMaxHeaderListSizeCanStillUseConnection() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java.
Where is encodeViolatesMaxHeaderListSizeCanStillUseConnection() defined?
encodeViolatesMaxHeaderListSizeCanStillUseConnection() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java at line 232.
What does encodeViolatesMaxHeaderListSizeCanStillUseConnection() call?
encodeViolatesMaxHeaderListSizeCanStillUseConnection() calls 1 function(s): bootstrapEnv.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free