errorDuringDeliveryShouldReturnCorrectNumberOfBytes() — netty Function Reference
Architecture documentation for the errorDuringDeliveryShouldReturnCorrectNumberOfBytes() function in DefaultHttp2ConnectionDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 93d1d58d_bb13_11ca_09a8_2989368a399d["errorDuringDeliveryShouldReturnCorrectNumberOfBytes()"] 7c0b580c_3a1b_cdb3_bf02_2ffea3bbdffc["DefaultHttp2ConnectionDecoderTest"] 93d1d58d_bb13_11ca_09a8_2989368a399d -->|defined in| 7c0b580c_3a1b_cdb3_bf02_2ffea3bbdffc style 93d1d58d_bb13_11ca_09a8_2989368a399d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoderTest.java lines 462–506
@Test
public void errorDuringDeliveryShouldReturnCorrectNumberOfBytes() throws Exception {
final ByteBuf data = dummyData();
final int padding = 10;
final AtomicInteger unprocessed = new AtomicInteger(data.readableBytes() + padding);
doAnswer(new Answer<Integer>() {
@Override
public Integer answer(InvocationOnMock in) throws Throwable {
return unprocessed.get();
}
}).when(localFlow).unconsumedBytes(eq(stream));
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock in) throws Throwable {
int delta = (Integer) in.getArguments()[1];
int newValue = unprocessed.addAndGet(-delta);
if (newValue < 0) {
throw new RuntimeException("Returned too many bytes");
}
return null;
}
}).when(localFlow).consumeBytes(eq(stream), anyInt());
// When the listener callback is called, process a few bytes and then throw.
doAnswer(new Answer<Integer>() {
@Override
public Integer answer(InvocationOnMock in) throws Throwable {
localFlow.consumeBytes(stream, 4);
throw new RuntimeException("Fake Exception");
}
}).when(listener).onDataRead(eq(ctx), eq(STREAM_ID), any(ByteBuf.class), eq(10), eq(true));
try {
assertThrows(RuntimeException.class, new Executable() {
@Override
public void execute() throws Throwable {
decode().onDataRead(ctx, STREAM_ID, data, padding, true);
}
});
verify(localFlow)
.receiveFlowControlledFrame(eq(stream), eq(data), eq(padding), eq(true));
verify(listener).onDataRead(eq(ctx), eq(STREAM_ID), eq(data), eq(padding), eq(true));
assertEquals(0, localFlow.unconsumedBytes(stream));
} finally {
data.release();
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does errorDuringDeliveryShouldReturnCorrectNumberOfBytes() do?
errorDuringDeliveryShouldReturnCorrectNumberOfBytes() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoderTest.java.
Where is errorDuringDeliveryShouldReturnCorrectNumberOfBytes() defined?
errorDuringDeliveryShouldReturnCorrectNumberOfBytes() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoderTest.java at line 462.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free