Home / Class/ ClientHandler Class — netty Architecture

ClientHandler Class — netty Architecture

Architecture documentation for the ClientHandler class in JdkDelegatingPrivateKeyMethodTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ed6aed8f_c389_4b4b_6f36_5f7dd9ea6871["ClientHandler"]
  5573b2bd_79a7_f28c_5ebe_732d956afd9a["JdkDelegatingPrivateKeyMethodTest.java"]
  ed6aed8f_c389_4b4b_6f36_5f7dd9ea6871 -->|defined in| 5573b2bd_79a7_f28c_5ebe_732d956afd9a
  35d1a24b_27ed_ea5f_b5fe_daf98be66d95["ClientHandler()"]
  ed6aed8f_c389_4b4b_6f36_5f7dd9ea6871 -->|method| 35d1a24b_27ed_ea5f_b5fe_daf98be66d95
  eddd8555_c6a7_8073_ec26_80b978cb4630["channelActive()"]
  ed6aed8f_c389_4b4b_6f36_5f7dd9ea6871 -->|method| eddd8555_c6a7_8073_ec26_80b978cb4630
  927a7221_0ff1_37af_1671_47762451e6da["channelRead()"]
  ed6aed8f_c389_4b4b_6f36_5f7dd9ea6871 -->|method| 927a7221_0ff1_37af_1671_47762451e6da
  70bd42e7_7b63_c9f0_0599_98b17d2f7866["exceptionCaught()"]
  ed6aed8f_c389_4b4b_6f36_5f7dd9ea6871 -->|method| 70bd42e7_7b63_c9f0_0599_98b17d2f7866

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethodTest.java lines 497–527

    private static final class ClientHandler extends ChannelInboundHandlerAdapter {
        final Promise<String> resultPromise;

        ClientHandler(Promise<String> resultPromise) {
            this.resultPromise = resultPromise;
        }

        @Override
        public void channelActive(ChannelHandlerContext ctx) {
            // Send single byte message once connection is established
            ByteBuf message = Unpooled.copiedBuffer("R", CharsetUtil.UTF_8);
            ctx.writeAndFlush(message);
        }

        @Override
        public void channelRead(ChannelHandlerContext ctx, Object msg) {
            // Close connection after receiving echo
            if (msg instanceof ByteBuf) {
                ByteBuf bytes = (ByteBuf) msg;
                resultPromise.setSuccess(bytes.toString(CharsetUtil.UTF_8));
                bytes.release();
                ctx.close();
            }
        }

        @Override
        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
            resultPromise.tryFailure(cause);
            ctx.close();
        }
    }

Frequently Asked Questions

What is the ClientHandler class?
ClientHandler is a class in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethodTest.java.
Where is ClientHandler defined?
ClientHandler is defined in handler/src/test/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethodTest.java at line 497.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free