Home / Class/ ObjectEchoClient Class — netty Architecture

ObjectEchoClient Class — netty Architecture

Architecture documentation for the ObjectEchoClient class in ObjectEchoClient.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  21b66d1d_a1e1_666b_90cb_cf3431f8f864["ObjectEchoClient"]
  15913c01_2d53_fa2d_b9a9_972c34b6ca88["ObjectEchoClient.java"]
  21b66d1d_a1e1_666b_90cb_cf3431f8f864 -->|defined in| 15913c01_2d53_fa2d_b9a9_972c34b6ca88
  73ba5c48_e1ae_e5d2_a12e_3b86e3f91159["main()"]
  21b66d1d_a1e1_666b_90cb_cf3431f8f864 -->|method| 73ba5c48_e1ae_e5d2_a12e_3b86e3f91159

Relationship Graph

Source Code

example/src/main/java/io/netty/example/objectecho/ObjectEchoClient.java lines 37–79

public final class ObjectEchoClient {

    static final boolean SSL = System.getProperty("ssl") != null;
    static final String HOST = System.getProperty("host", "127.0.0.1");
    static final int PORT = Integer.parseInt(System.getProperty("port", "8007"));
    static final int SIZE = Integer.parseInt(System.getProperty("size", "256"));

    public static void main(String[] args) throws Exception {
        // Configure SSL.
        final SslContext sslCtx;
        if (SSL) {
            sslCtx = SslContextBuilder.forClient()
                .trustManager(InsecureTrustManagerFactory.INSTANCE).build();
        } else {
            sslCtx = null;
        }

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .handler(new ChannelInitializer<SocketChannel>() {
                @Override
                public void initChannel(SocketChannel ch) throws Exception {
                    ChannelPipeline p = ch.pipeline();
                    if (sslCtx != null) {
                        p.addLast(sslCtx.newHandler(ch.alloc(), HOST, PORT));
                    }
                    p.addLast(
                            new ObjectEncoder(),
                            new ObjectDecoder(ClassResolvers.cacheDisabled(null)),
                            new ObjectEchoClientHandler());
                }
             });

            // Start the connection attempt.
            b.connect(HOST, PORT).sync().channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

What is the ObjectEchoClient class?
ObjectEchoClient is a class in the netty codebase, defined in example/src/main/java/io/netty/example/objectecho/ObjectEchoClient.java.
Where is ObjectEchoClient defined?
ObjectEchoClient is defined in example/src/main/java/io/netty/example/objectecho/ObjectEchoClient.java at line 37.

Analyze Your Own Codebase

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

Try Supermodel Free