Home / Function/ clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() — netty Function Reference

clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() — netty Function Reference

Architecture documentation for the clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() function in SSLEngineTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bfe6f0b3_5387_9664_b28e_4090d9fe2eca["clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer()"]
  9150c92a_2afc_b83a_c3bf_86dfac6e9d9b["SSLEngineTest"]
  bfe6f0b3_5387_9664_b28e_4090d9fe2eca -->|defined in| 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b
  bf19737b_7dc7_9dfd_0a67_ae31448ebbe8["protocols()"]
  bfe6f0b3_5387_9664_b28e_4090d9fe2eca -->|calls| bf19737b_7dc7_9dfd_0a67_ae31448ebbe8
  e3b541e6_b593_4b1f_a637_da19020e73df["ciphers()"]
  bfe6f0b3_5387_9664_b28e_4090d9fe2eca -->|calls| e3b541e6_b593_4b1f_a637_da19020e73df
  d074ce38_190b_dae8_46f6_82b7c5e7ecaf["TestByteBufAllocator()"]
  bfe6f0b3_5387_9664_b28e_4090d9fe2eca -->|calls| d074ce38_190b_dae8_46f6_82b7c5e7ecaf
  7380f50e_d3f0_3078_ee65_de1cb780c79d["handshake()"]
  bfe6f0b3_5387_9664_b28e_4090d9fe2eca -->|calls| 7380f50e_d3f0_3078_ee65_de1cb780c79d
  style bfe6f0b3_5387_9664_b28e_4090d9fe2eca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java lines 1485–1612

    @MethodSource("newTestParams")
    @ParameterizedTest
    @Timeout(30)
    public void clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer(final SSLEngineTestParam param)
            throws Exception {
        assumeTrue(PlatformDependent.javaVersion() >= 11);
        final SelfSignedCertificate ssc = CachedSelfSignedCertificate.getCachedCertificate();
        serverSslCtx = wrapContext(param, SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
                                        .sslProvider(sslServerProvider())
                                        .sslContextProvider(serverSslContextProvider())
                                        .protocols(param.protocols())
                                        .ciphers(param.ciphers())
                                        .build());
        sb = new ServerBootstrap()
                .group(new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory()))
                .channel(NioServerSocketChannel.class)
                .childHandler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    public void initChannel(SocketChannel ch) {
                        ch.config().setAllocator(new TestByteBufAllocator(ch.config().getAllocator(), param.type));

                        ChannelPipeline p = ch.pipeline();

                        SslHandler handler = !param.delegate ?
                                serverSslCtx.newHandler(ch.alloc()) :
                                serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);

                        p.addLast(handler);
                        p.addLast(new ChannelInboundHandlerAdapter() {
                            @Override
                            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
                                if (evt instanceof SslHandshakeCompletionEvent &&
                                        ((SslHandshakeCompletionEvent) evt).isSuccess()) {
                                    // This data will be sent to the client before any of the re-negotiation data can be
                                    // sent. The client will read this, detect that it is not the response to
                                    // renegotiation which was expected, and respond with a fatal alert.
                                    ctx.writeAndFlush(ctx.alloc().buffer(1).writeByte(100));
                                }
                                ctx.fireUserEventTriggered(evt);
                            }

                            @Override
                            public void channelRead(final ChannelHandlerContext ctx, Object msg) {
                                ReferenceCountUtil.release(msg);
                                // The server then attempts to trigger a flush operation once the application data is
                                // received from the client. The flush will encrypt all data and should not result in
                                // deadlock.
                                ctx.channel().eventLoop().schedule(new Runnable() {
                                    @Override
                                    public void run() {
                                        ctx.writeAndFlush(ctx.alloc().buffer(1).writeByte(101));
                                    }
                                }, 500, TimeUnit.MILLISECONDS);
                            }

                            @Override
                            public void channelInactive(ChannelHandlerContext ctx) {
                                serverLatch.countDown();
                            }
                        });
                        serverConnectedChannel = ch;
                    }
                });

        serverChannel = sb.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();

        clientSslCtx = wrapContext(param, SslContextBuilder.forClient()
                                        // OpenSslEngine doesn't support renegotiation on client side
                                        .sslProvider(SslProvider.JDK)
                                        .trustManager(InsecureTrustManagerFactory.INSTANCE)
                                        .protocols(param.protocols())
                                        .ciphers(param.ciphers())
                                        .build());

        cb = new Bootstrap();
        cb.group(new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory()))
                .channel(NioSocketChannel.class)
                .handler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    public void initChannel(SocketChannel ch) {
                        ch.config().setAllocator(new TestByteBufAllocator(ch.config().getAllocator(), param.type()));

Domain

Subdomains

Frequently Asked Questions

What does clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() do?
clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java.
Where is clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() defined?
clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() is defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java at line 1485.
What does clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() call?
clientInitiatedRenegotiationWithFatalAlertDoesNotInfiniteLoopServer() calls 4 function(s): TestByteBufAllocator, ciphers, handshake, protocols.

Analyze Your Own Codebase

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

Try Supermodel Free