testScatteringReadWithSmallBuffer0() — netty Function Reference
Architecture documentation for the testScatteringReadWithSmallBuffer0() function in EpollDatagramScatteringReadTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD da055b2f_ebc1_2209_ca25_ac81e49ad730["testScatteringReadWithSmallBuffer0()"] 84cf7040_5cb1_94bd_4284_dae23d74ab93["EpollDatagramScatteringReadTest"] da055b2f_ebc1_2209_ca25_ac81e49ad730 -->|defined in| 84cf7040_5cb1_94bd_4284_dae23d74ab93 938686fd_bcbc_656b_0089_cf4abaa740f1["testScatteringReadWithSmallBuffer()"] 938686fd_bcbc_656b_0089_cf4abaa740f1 -->|calls| da055b2f_ebc1_2209_ca25_ac81e49ad730 ca9cca6b_d225_bd0a_63c0_29218f0fdadb["testScatteringConnectedReadWithSmallBuffer()"] ca9cca6b_d225_bd0a_63c0_29218f0fdadb -->|calls| da055b2f_ebc1_2209_ca25_ac81e49ad730 style da055b2f_ebc1_2209_ca25_ac81e49ad730 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramScatteringReadTest.java lines 237–306
private void testScatteringReadWithSmallBuffer0(Bootstrap sb, Bootstrap cb, boolean connected) throws Throwable {
int packetSize = 16;
sb.option(ChannelOption.RECVBUF_ALLOCATOR, new AdaptiveRecvByteBufAllocator(1400, 1400, 64 * 1024));
sb.option(EpollChannelOption.MAX_DATAGRAM_PAYLOAD_SIZE, 1400);
Channel sc = null;
Channel cc = null;
try {
cb.handler(new SimpleChannelInboundHandler<Object>() {
@Override
public void channelRead0(ChannelHandlerContext ctx, Object msgs) {
// Nothing will be sent.
}
});
cc = cb.bind(newSocketAddress()).sync().channel();
final SocketAddress ccAddress = cc.localAddress();
final AtomicReference<Throwable> errorRef = new AtomicReference<Throwable>();
final byte[] bytes = new byte[packetSize];
ThreadLocalRandom.current().nextBytes(bytes);
final CountDownLatch latch = new CountDownLatch(1);
sb.handler(new SimpleChannelInboundHandler<DatagramPacket>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) {
assertEquals(ccAddress, msg.sender());
assertEquals(bytes.length, msg.content().readableBytes());
byte[] receivedBytes = new byte[bytes.length];
msg.content().readBytes(receivedBytes);
assertArrayEquals(bytes, receivedBytes);
latch.countDown();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
errorRef.compareAndSet(null, cause);
}
});
sc = sb.bind(newSocketAddress()).sync().channel();
if (connected) {
sc.connect(cc.localAddress()).syncUninterruptibly();
}
InetSocketAddress addr = (InetSocketAddress) sc.localAddress();
cc.writeAndFlush(new DatagramPacket(cc.alloc().directBuffer().writeBytes(bytes), addr)).sync();
if (!latch.await(10, TimeUnit.SECONDS)) {
Throwable error = errorRef.get();
if (error != null) {
throw error;
}
fail("Timeout while waiting for packets");
}
} finally {
if (cc != null) {
cc.close().syncUninterruptibly();
}
if (sc != null) {
sc.close().syncUninterruptibly();
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testScatteringReadWithSmallBuffer0() do?
testScatteringReadWithSmallBuffer0() is a function in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramScatteringReadTest.java.
Where is testScatteringReadWithSmallBuffer0() defined?
testScatteringReadWithSmallBuffer0() is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramScatteringReadTest.java at line 237.
What calls testScatteringReadWithSmallBuffer0()?
testScatteringReadWithSmallBuffer0() is called by 2 function(s): testScatteringConnectedReadWithSmallBuffer, testScatteringReadWithSmallBuffer.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free