Home / Function/ main() — netty Function Reference

main() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7bc8e18a_6d09_2c08_3c11_207591407424["main()"]
  584cf7f3_f52d_d2f3_ff7e_4fc4c81a81b1["HAProxyClient"]
  7bc8e18a_6d09_2c08_3c11_207591407424 -->|defined in| 584cf7f3_f52d_d2f3_ff7e_4fc4c81a81b1
  style 7bc8e18a_6d09_2c08_3c11_207591407424 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/haproxy/HAProxyClient.java lines 38–60

    public static void main(String[] args) throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .handler(new HAProxyHandler());

            // Start the connection attempt.
            Channel ch = b.connect(HOST, PORT).sync().channel();

            HAProxyMessage message = new HAProxyMessage(
                    HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4,
                    "127.0.0.1", "127.0.0.2", 8000, 9000);

            ch.writeAndFlush(message).sync();
            ch.writeAndFlush(Unpooled.copiedBuffer("Hello World!", CharsetUtil.US_ASCII)).sync();
            ch.writeAndFlush(Unpooled.copiedBuffer("Bye now!", CharsetUtil.US_ASCII)).sync();
            ch.close().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/haproxy/HAProxyClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/haproxy/HAProxyClient.java at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free