testCorrectlyHandleWritability() — netty Function Reference
Architecture documentation for the testCorrectlyHandleWritability() function in QuicWritableTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0c51c71a_ccea_b11c_6bb1_4bc55ad9ae2e["testCorrectlyHandleWritability()"] fc9631ee_db80_8adf_d64a_56d79928a459["QuicWritableTest"] 0c51c71a_ccea_b11c_6bb1_4bc55ad9ae2e -->|defined in| fc9631ee_db80_8adf_d64a_56d79928a459 ba22eed2_5690_df55_0f36_796f45fdb738["testCorrectlyHandleWritabilityReadRequestedInReadComplete()"] ba22eed2_5690_df55_0f36_796f45fdb738 -->|calls| 0c51c71a_ccea_b11c_6bb1_4bc55ad9ae2e f023f3e2_ce2a_f343_d584_aa1d9f4d93ec["testCorrectlyHandleWritabilityReadRequestedInRead()"] f023f3e2_ce2a_f343_d584_aa1d9f4d93ec -->|calls| 0c51c71a_ccea_b11c_6bb1_4bc55ad9ae2e eb3e5605_b19c_e126_0e8a_d4feca0d1a1d["throwIfNotNull()"] 0c51c71a_ccea_b11c_6bb1_4bc55ad9ae2e -->|calls| eb3e5605_b19c_e126_0e8a_d4feca0d1a1d style 0c51c71a_ccea_b11c_6bb1_4bc55ad9ae2e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicWritableTest.java lines 55–163
private static void testCorrectlyHandleWritability(Executor executor, boolean readInComplete) throws Throwable {
int bufferSize = 64 * 1024;
Promise<Void> writePromise = ImmediateEventExecutor.INSTANCE.newPromise();
final AtomicReference<Throwable> serverErrorRef = new AtomicReference<>();
final AtomicReference<Throwable> clientErrorRef = new AtomicReference<>();
QuicChannelValidationHandler serverHandler = new QuicChannelValidationHandler();
Channel server = QuicTestUtils.newServer(
QuicTestUtils.newQuicServerBuilder(executor).initialMaxStreamsBidirectional(5000),
InsecureQuicTokenHandler.INSTANCE,
serverHandler, new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ByteBuf buffer = (ByteBuf) msg;
buffer.release();
ctx.writeAndFlush(ctx.alloc().buffer(bufferSize).writeZero(bufferSize))
.addListener(new PromiseNotifier<>(writePromise));
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
serverErrorRef.set(cause);
}
@Override
public boolean isSharable() {
return true;
}
});
InetSocketAddress address = (InetSocketAddress) server.localAddress();
Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor)
.initialMaxStreamDataBidirectionalLocal(bufferSize / 4));
QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler();
try {
QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
.handler(clientHandler)
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect()
.get();
QuicStreamChannel stream = quicChannel.createStream(
QuicStreamType.BIDIRECTIONAL, new ChannelInboundHandlerAdapter() {
int bytes;
@Override
public void channelRegistered(ChannelHandlerContext ctx) {
ctx.channel().config().setAutoRead(false);
}
@Override
public void channelActive(ChannelHandlerContext ctx) {
ctx.writeAndFlush(ctx.alloc().buffer(8).writeLong(8));
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (bytes == 0) {
// First read
assertFalse(writePromise.isDone());
}
ByteBuf buffer = (ByteBuf) msg;
bytes += buffer.readableBytes();
buffer.release();
if (bytes == bufferSize) {
ctx.close();
assertTrue(writePromise.isDone());
}
if (!readInComplete) {
ctx.read();
}
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
if (readInComplete) {
ctx.read();
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does testCorrectlyHandleWritability() do?
testCorrectlyHandleWritability() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicWritableTest.java.
Where is testCorrectlyHandleWritability() defined?
testCorrectlyHandleWritability() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicWritableTest.java at line 55.
What does testCorrectlyHandleWritability() call?
testCorrectlyHandleWritability() calls 1 function(s): throwIfNotNull.
What calls testCorrectlyHandleWritability()?
testCorrectlyHandleWritability() is called by 2 function(s): testCorrectlyHandleWritabilityReadRequestedInRead, testCorrectlyHandleWritabilityReadRequestedInReadComplete.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free