EchoHandler Class — netty Architecture
Architecture documentation for the EchoHandler class in EpollSpliceTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b557b3ec_58e6_8714_041d_c4548d470956["EchoHandler"] 4a8d8d02_d652_cbc3_7bc3_f0b30eca63df["EpollSpliceTest.java"] b557b3ec_58e6_8714_041d_c4548d470956 -->|defined in| 4a8d8d02_d652_cbc3_7bc3_f0b30eca63df c39ca91e_0b7d_217e_568b_15358192efc4["channelActive()"] b557b3ec_58e6_8714_041d_c4548d470956 -->|method| c39ca91e_0b7d_217e_568b_15358192efc4 53875a44_f73f_3381_8d02_448eff69f5a4["channelRead0()"] b557b3ec_58e6_8714_041d_c4548d470956 -->|method| 53875a44_f73f_3381_8d02_448eff69f5a4 e0d2af12_92f2_a7b2_f975_182fcba743d5["channelReadComplete()"] b557b3ec_58e6_8714_041d_c4548d470956 -->|method| e0d2af12_92f2_a7b2_f975_182fcba743d5 f7238c0d_50e0_eb10_a12d_2ac05747a495["exceptionCaught()"] b557b3ec_58e6_8714_041d_c4548d470956 -->|method| f7238c0d_50e0_eb10_a12d_2ac05747a495
Relationship Graph
Source Code
transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSpliceTest.java lines 239–280
private static class EchoHandler extends SimpleChannelInboundHandler<ByteBuf> {
volatile Channel channel;
final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
volatile int counter;
@Override
public void channelActive(ChannelHandlerContext ctx)
throws Exception {
channel = ctx.channel();
}
@Override
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
byte[] actual = new byte[in.readableBytes()];
in.readBytes(actual);
int lastIdx = counter;
for (int i = 0; i < actual.length; i ++) {
assertEquals(data[i + lastIdx], actual[i]);
}
if (channel.parent() != null) {
channel.write(Unpooled.wrappedBuffer(actual));
}
counter += actual.length;
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx,
Throwable cause) throws Exception {
if (exception.compareAndSet(null, cause)) {
cause.printStackTrace();
ctx.close();
}
}
}
Source
Frequently Asked Questions
What is the EchoHandler class?
EchoHandler is a class in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSpliceTest.java.
Where is EchoHandler defined?
EchoHandler is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSpliceTest.java at line 239.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free