headersWriteForPeerStreamWhichWasResetShouldNotGoAway() — netty Function Reference
Architecture documentation for the headersWriteForPeerStreamWhichWasResetShouldNotGoAway() function in Http2ConnectionRoundtripTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8975d416_be2b_5967_efb0_c5e70ccff14c["headersWriteForPeerStreamWhichWasResetShouldNotGoAway()"] 0d6189e8_c033_39ff_d087_9019351440fe["Http2ConnectionRoundtripTest"] 8975d416_be2b_5967_efb0_c5e70ccff14c -->|defined in| 0d6189e8_c033_39ff_d087_9019351440fe 1dd685b8_9b56_5b35_70ca_7f2bf9016254["bootstrapEnv()"] 8975d416_be2b_5967_efb0_c5e70ccff14c -->|calls| 1dd685b8_9b56_5b35_70ca_7f2bf9016254 style 8975d416_be2b_5967_efb0_c5e70ccff14c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java lines 507–567
@Test
public void headersWriteForPeerStreamWhichWasResetShouldNotGoAway() throws Exception {
final CountDownLatch serverGotRstLatch = new CountDownLatch(1);
final CountDownLatch serverWriteHeadersLatch = new CountDownLatch(1);
final AtomicReference<Throwable> serverWriteHeadersCauseRef = new AtomicReference<Throwable>();
final int streamId = 3;
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
if (streamId == (Integer) invocationOnMock.getArgument(1)) {
serverGotRstLatch.countDown();
}
return null;
}
}).when(serverListener).onRstStreamRead(any(ChannelHandlerContext.class), eq(streamId), anyLong());
bootstrapEnv(1, 1, 1, 0);
final Http2Headers headers = dummyHeaders();
runInChannel(clientChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Client.encoder().writeHeaders(ctx(), streamId, headers, CONNECTION_STREAM_ID,
DEFAULT_PRIORITY_WEIGHT, false, 0, false, newPromise());
http2Client.encoder().writeRstStream(ctx(), streamId, Http2Error.CANCEL.code(), newPromise());
http2Client.flush(ctx());
}
});
assertTrue(serverSettingsAckLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
assertTrue(serverGotRstLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(streamId), eq(headers), anyInt(),
anyShort(), anyBoolean(), anyInt(), eq(false));
// Now have the server attempt to send a headers frame simulating some asynchronous work.
runInChannel(serverConnectedChannel, new Http2Runnable() {
@Override
public void run() throws Http2Exception {
http2Server.encoder().writeHeaders(serverCtx(), streamId, headers, 0, true, serverNewPromise())
.addListener(future -> {
serverWriteHeadersCauseRef.set(future.cause());
serverWriteHeadersLatch.countDown();
});
http2Server.flush(serverCtx());
}
});
assertTrue(serverWriteHeadersLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
Throwable serverWriteHeadersCause = serverWriteHeadersCauseRef.get();
assertNotNull(serverWriteHeadersCause);
assertThat(serverWriteHeadersCauseRef.get()).isNotInstanceOf(Http2Exception.class);
// Server should receive a RST_STREAM for stream 3.
verify(serverListener, never()).onGoAwayRead(any(ChannelHandlerContext.class), anyInt(), anyLong(),
any(ByteBuf.class));
verify(clientListener, never()).onGoAwayRead(any(ChannelHandlerContext.class), anyInt(), anyLong(),
any(ByteBuf.class));
verify(clientListener, never()).onRstStreamRead(any(ChannelHandlerContext.class), anyInt(), anyLong());
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does headersWriteForPeerStreamWhichWasResetShouldNotGoAway() do?
headersWriteForPeerStreamWhichWasResetShouldNotGoAway() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java.
Where is headersWriteForPeerStreamWhichWasResetShouldNotGoAway() defined?
headersWriteForPeerStreamWhichWasResetShouldNotGoAway() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java at line 507.
What does headersWriteForPeerStreamWhichWasResetShouldNotGoAway() call?
headersWriteForPeerStreamWhichWasResetShouldNotGoAway() 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