Home / Class/ EchoClient Class — netty Architecture

EchoClient Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  9b63ceab_87e3_0d3e_6024_c3e1c3e4b7b3["EchoClient"]
  86e0ccfb_f2d0_3ea2_7e73_c46b084b3140["EchoClient.java"]
  9b63ceab_87e3_0d3e_6024_c3e1c3e4b7b3 -->|defined in| 86e0ccfb_f2d0_3ea2_7e73_c46b084b3140
  aa284012_cea2_1367_c4bc_6adcdcc1ef83["main()"]
  9b63ceab_87e3_0d3e_6024_c3e1c3e4b7b3 -->|method| aa284012_cea2_1367_c4bc_6adcdcc1ef83

Relationship Graph

Source Code

example/src/main/java/io/netty/example/echo/EchoClient.java lines 37–76

public final class EchoClient {

    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.git
        final SslContext sslCtx = ServerUtil.buildSslContext();

        // Configure the client.
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.TCP_NODELAY, true)
             .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 LoggingHandler(LogLevel.INFO));
                     p.addLast(new EchoClientHandler());
                 }
             });

            // Start the client.
            ChannelFuture f = b.connect(HOST, PORT).sync();

            // Wait until the connection is closed.
            f.channel().closeFuture().sync();
        } finally {
            // Shut down the event loop to terminate all threads.
            group.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free