Home / Function/ newChannelAndSendData() — netty Function Reference

newChannelAndSendData() — netty Function Reference

Architecture documentation for the newChannelAndSendData() function in QuicClientZeroRTTExample.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  0b50309a_9360_0fb3_1b8d_1c4a3d1ac0ab["newChannelAndSendData()"]
  40abcc0a_1b6f_95df_e40b_99a4345531f2["QuicClientZeroRTTExample"]
  0b50309a_9360_0fb3_1b8d_1c4a3d1ac0ab -->|defined in| 40abcc0a_1b6f_95df_e40b_99a4345531f2
  860d8561_a1bb_23ff_6c07_2e9bea82ddbc["main()"]
  860d8561_a1bb_23ff_6c07_2e9bea82ddbc -->|calls| 0b50309a_9360_0fb3_1b8d_1c4a3d1ac0ab
  f2361233_d807_e21f_32f0_2702a50cf848["createStream()"]
  0b50309a_9360_0fb3_1b8d_1c4a3d1ac0ab -->|calls| f2361233_d807_e21f_32f0_2702a50cf848
  style 0b50309a_9360_0fb3_1b8d_1c4a3d1ac0ab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-native-quic/src/test/java/io/netty/handler/codec/quic/example/QuicClientZeroRTTExample.java lines 72–120

    static void newChannelAndSendData(QuicSslContext context, ChannelHandler earlyDataSendHandler) throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory());
        try {
            ChannelHandler codec = new QuicClientCodecBuilder()
                    .sslEngineProvider(q -> context.newEngine(q.alloc(), "localhost", 9999))
                    .maxIdleTimeout(5000, TimeUnit.MILLISECONDS)
                    .initialMaxData(10000000)
                    // As we don't want to support remote initiated streams just setup the limit for local initiated
                    // streams in this example.
                    .initialMaxStreamDataBidirectionalLocal(1000000)
                    .build();

            Bootstrap bs = new Bootstrap();
            Channel channel = bs.group(group)
                    .channel(NioDatagramChannel.class)
                    .handler(codec)
                    .bind(0).sync().channel();

            QuicChannelBootstrap quicChannelBootstrap = QuicChannel.newBootstrap(channel)
                    .streamHandler(new ChannelInboundHandlerAdapter() {
                        @Override
                        public void channelActive(ChannelHandlerContext ctx) {
                            // As we did not allow any remote initiated streams we will never see this method called.
                            // That said just let us keep it here to demonstrate that this handle would be called
                            // for each remote initiated stream.
                            ctx.close();
                        }
                    })
                    .remoteAddress(new InetSocketAddress(NetUtil.LOCALHOST4, 9999));

            if (earlyDataSendHandler != null) {
                quicChannelBootstrap.handler(earlyDataSendHandler);
            }

            QuicChannel quicChannel = quicChannelBootstrap
                    .connect()
                    .get();

            QuicStreamChannel streamChannel = createStream(quicChannel).sync().getNow();
            // Write the data and send the FIN. After this its not possible anymore to write any more data.
            streamChannel.writeAndFlush(Unpooled.copiedBuffer("Bye\r\n", CharsetUtil.US_ASCII))
                    .addListener(QuicStreamChannel.SHUTDOWN_OUTPUT);
            streamChannel.closeFuture().sync();
            quicChannel.closeFuture().sync();
            channel.close().sync();
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does newChannelAndSendData() do?
newChannelAndSendData() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/example/QuicClientZeroRTTExample.java.
Where is newChannelAndSendData() defined?
newChannelAndSendData() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/example/QuicClientZeroRTTExample.java at line 72.
What does newChannelAndSendData() call?
newChannelAndSendData() calls 1 function(s): createStream.
What calls newChannelAndSendData()?
newChannelAndSendData() is called by 1 function(s): main.

Analyze Your Own Codebase

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

Try Supermodel Free