testSettingsAckIsSentBeforeUsingFlowControl() — netty Function Reference
Architecture documentation for the testSettingsAckIsSentBeforeUsingFlowControl() function in Http2ConnectionRoundtripTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD f54d388f_d30d_8bd4_0f10_a022a29e39de["testSettingsAckIsSentBeforeUsingFlowControl()"] 0d6189e8_c033_39ff_d087_9019351440fe["Http2ConnectionRoundtripTest"] f54d388f_d30d_8bd4_0f10_a022a29e39de -->|defined in| 0d6189e8_c033_39ff_d087_9019351440fe 1dd685b8_9b56_5b35_70ca_7f2bf9016254["bootstrapEnv()"] f54d388f_d30d_8bd4_0f10_a022a29e39de -->|calls| 1dd685b8_9b56_5b35_70ca_7f2bf9016254 style f54d388f_d30d_8bd4_0f10_a022a29e39de fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java lines 352–439
@Test
public void testSettingsAckIsSentBeforeUsingFlowControl() throws Exception {
final CountDownLatch serverSettingsAckLatch1 = new CountDownLatch(1);
final CountDownLatch serverSettingsAckLatch2 = new CountDownLatch(2);
final CountDownLatch serverDataLatch = new CountDownLatch(1);
final CountDownLatch clientWriteDataLatch = new CountDownLatch(1);
final byte[] data = new byte[] {1, 2, 3, 4, 5};
final ByteArrayOutputStream out = new ByteArrayOutputStream(data.length);
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<Integer>() {
@Override
public Integer answer(InvocationOnMock in) throws Throwable {
ByteBuf buf = (ByteBuf) in.getArguments()[2];
int padding = (Integer) in.getArguments()[3];
int processedBytes = buf.readableBytes() + padding;
buf.readBytes(out, buf.readableBytes());
serverDataLatch.countDown();
return processedBytes;
}
}).when(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3),
any(ByteBuf.class), eq(0), anyBoolean());
bootstrapEnv(1, 1, 2, 1);
final Http2Headers headers = dummyHeaders();
// The server initially reduces the connection flow control window to 0.
runInChannel(serverConnectedChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Server.encoder().writeSettings(serverCtx(),
new Http2Settings().copyFrom(http2Server.decoder().localSettings())
.initialWindowSize(0),
serverNewPromise());
http2Server.flush(serverCtx());
}
});
assertTrue(serverSettingsAckLatch1.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
// The client should now attempt to send data, but the window size is 0 so it will be queued in the flow
// controller.
runInChannel(clientChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Client.encoder().writeHeaders(ctx(), 3, headers, 0, (short) 16, false, 0, false,
newPromise());
http2Client.encoder().writeData(ctx(), 3, Unpooled.wrappedBuffer(data), 0, true, newPromise());
http2Client.flush(ctx());
clientWriteDataLatch.countDown();
}
});
assertTrue(clientWriteDataLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
// Now the server opens up the connection window to allow the client to send the pending data.
runInChannel(serverConnectedChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Server.encoder().writeSettings(serverCtx(),
new Http2Settings().copyFrom(http2Server.decoder().localSettings())
.initialWindowSize(data.length),
serverNewPromise());
http2Server.flush(serverCtx());
}
});
assertTrue(serverSettingsAckLatch2.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
assertTrue(serverDataLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
assertArrayEquals(data, out.toByteArray());
// Verify that no errors have been received.
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does testSettingsAckIsSentBeforeUsingFlowControl() do?
testSettingsAckIsSentBeforeUsingFlowControl() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java.
Where is testSettingsAckIsSentBeforeUsingFlowControl() defined?
testSettingsAckIsSentBeforeUsingFlowControl() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java at line 352.
What does testSettingsAckIsSentBeforeUsingFlowControl() call?
testSettingsAckIsSentBeforeUsingFlowControl() 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