testRequestWithBody() — netty Function Reference
Architecture documentation for the testRequestWithBody() function in HttpToHttp2ConnectionHandlerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 72f99b4d_235b_b582_10c5_0c6d4c996798["testRequestWithBody()"] 919b1457_fbee_0bc0_c865_945a03b794b1["HttpToHttp2ConnectionHandlerTest"] 72f99b4d_235b_b582_10c5_0c6d4c996798 -->|defined in| 919b1457_fbee_0bc0_c865_945a03b794b1 5a522eb6_40fe_3d12_39a2_24e8e6f43e87["bootstrapEnv()"] 72f99b4d_235b_b582_10c5_0c6d4c996798 -->|calls| 5a522eb6_40fe_3d12_39a2_24e8e6f43e87 84d6c67b_74d9_4885_d2f1_6360667127ac["awaitRequests()"] 72f99b4d_235b_b582_10c5_0c6d4c996798 -->|calls| 84d6c67b_74d9_4885_d2f1_6360667127ac style 72f99b4d_235b_b582_10c5_0c6d4c996798 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/HttpToHttp2ConnectionHandlerTest.java lines 385–426
@Test
public void testRequestWithBody() throws Exception {
final String text = "foooooogoooo";
final List<String> receivedBuffers = Collections.synchronizedList(new ArrayList<String>());
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock in) throws Throwable {
receivedBuffers.add(((ByteBuf) in.getArguments()[2]).toString(UTF_8));
return null;
}
}).when(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3),
any(ByteBuf.class), eq(0), eq(true));
bootstrapEnv(3, 1, 0);
final FullHttpRequest request = new DefaultFullHttpRequest(HTTP_1_1, POST,
"http://your_user-name123@www.example.org:5555/example",
Unpooled.copiedBuffer(text, UTF_8));
final HttpHeaders httpHeaders = request.headers();
httpHeaders.set(HttpHeaderNames.HOST, "www.example-origin.org:5555");
httpHeaders.add(of("foo"), of("goo"));
httpHeaders.add(of("foo"), of("goo2"));
httpHeaders.add(of("foo2"), of("goo2"));
final Http2Headers http2Headers =
new DefaultHttp2Headers().method(new AsciiString("POST")).path(new AsciiString("/example"))
.authority(new AsciiString("www.example-origin.org:5555")).scheme(new AsciiString("http"))
.add(new AsciiString("foo"), new AsciiString("goo"))
.add(new AsciiString("foo"), new AsciiString("goo2"))
.add(new AsciiString("foo2"), new AsciiString("goo2"));
ChannelPromise writePromise = newPromise();
ChannelFuture writeFuture = clientChannel.writeAndFlush(request, writePromise);
assertTrue(writePromise.awaitUninterruptibly(WAIT_TIME_SECONDS, SECONDS));
assertTrue(writePromise.isSuccess());
assertTrue(writeFuture.awaitUninterruptibly(WAIT_TIME_SECONDS, SECONDS));
assertTrue(writeFuture.isSuccess());
awaitRequests();
verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(3), eq(http2Headers), eq(0),
anyShort(), anyBoolean(), eq(0), eq(false));
verify(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3), any(ByteBuf.class), eq(0),
eq(true));
assertEquals(1, receivedBuffers.size());
assertEquals(text, receivedBuffers.get(0));
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testRequestWithBody() do?
testRequestWithBody() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HttpToHttp2ConnectionHandlerTest.java.
Where is testRequestWithBody() defined?
testRequestWithBody() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HttpToHttp2ConnectionHandlerTest.java at line 385.
What does testRequestWithBody() call?
testRequestWithBody() calls 2 function(s): awaitRequests, bootstrapEnv.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free