Home / Function/ main() — netty Function Reference

main() — netty Function Reference

Architecture documentation for the main() function in ObjectEchoClient.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  73ba5c48_e1ae_e5d2_a12e_3b86e3f91159["main()"]
  21b66d1d_a1e1_666b_90cb_cf3431f8f864["ObjectEchoClient"]
  73ba5c48_e1ae_e5d2_a12e_3b86e3f91159 -->|defined in| 21b66d1d_a1e1_666b_90cb_cf3431f8f864
  style 73ba5c48_e1ae_e5d2_a12e_3b86e3f91159 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/objectecho/ObjectEchoClient.java lines 44–78

    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();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/objectecho/ObjectEchoClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/objectecho/ObjectEchoClient.java at line 44.

Analyze Your Own Codebase

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

Try Supermodel Free