Home / Function/ testHandshakeFailureCipherMissmatch() — netty Function Reference

testHandshakeFailureCipherMissmatch() — netty Function Reference

Architecture documentation for the testHandshakeFailureCipherMissmatch() function in SslHandlerTest.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 4

Entity Profile

Dependency Diagram

graph TD
  9ae998f0_abee_f973_a345_519dc9f44666["testHandshakeFailureCipherMissmatch()"]
  adaf7dc7_94e2_152f_ffdb_453fdaa4f25e["SslHandlerTest"]
  9ae998f0_abee_f973_a345_519dc9f44666 -->|defined in| adaf7dc7_94e2_152f_ffdb_453fdaa4f25e
  a2579354_69de_720b_3d5b_6cb3ffc0ca60["testHandshakeFailureCipherMissmatchTLSv12Jdk()"]
  a2579354_69de_720b_3d5b_6cb3ffc0ca60 -->|calls| 9ae998f0_abee_f973_a345_519dc9f44666
  bcef78da_11d0_f918_0469_522da35f5a12["testHandshakeFailureCipherMissmatchTLSv13Jdk()"]
  bcef78da_11d0_f918_0469_522da35f5a12 -->|calls| 9ae998f0_abee_f973_a345_519dc9f44666
  33bab30b_9f02_1d73_d85c_65577cbed69b["testHandshakeFailureCipherMissmatchTLSv12OpenSsl()"]
  33bab30b_9f02_1d73_d85c_65577cbed69b -->|calls| 9ae998f0_abee_f973_a345_519dc9f44666
  09dae69e_cc41_b372_fd9e_9a5aaa48e554["testHandshakeFailureCipherMissmatchTLSv13OpenSsl()"]
  09dae69e_cc41_b372_fd9e_9a5aaa48e554 -->|calls| 9ae998f0_abee_f973_a345_519dc9f44666
  09e28321_991b_cd70_043b_cf8d02ac5d9c["SslEventHandler()"]
  9ae998f0_abee_f973_a345_519dc9f44666 -->|calls| 09e28321_991b_cd70_043b_cf8d02ac5d9c
  0fd148d9_de21_9e3d_3bde_be07148f32de["userEventTriggered()"]
  9ae998f0_abee_f973_a345_519dc9f44666 -->|calls| 0fd148d9_de21_9e3d_3bde_be07148f32de
  style 9ae998f0_abee_f973_a345_519dc9f44666 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java lines 1579–1676

    private static void testHandshakeFailureCipherMissmatch(SslProvider provider, boolean tls13) throws Exception {
        final String clientCipher;
        final String serverCipher;
        final String protocol;

        if (tls13) {
            clientCipher = "TLS_AES_128_GCM_SHA256";
            serverCipher = "TLS_AES_256_GCM_SHA384";
            protocol = SslProtocols.TLS_v1_3;
        } else {
            clientCipher = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256";
            serverCipher = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384";
            protocol = SslProtocols.TLS_v1_2;
        }
        final SslContext sslClientCtx = SslContextBuilder.forClient()
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .protocols(protocol)
                .ciphers(Collections.singleton(clientCipher))
                .sslProvider(provider).build();

        final SelfSignedCertificate cert = CachedSelfSignedCertificate.getCachedCertificate();
        final SslContext sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert())
                .protocols(protocol)
                .ciphers(Collections.singleton(serverCipher))
                .sslProvider(provider).build();

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        Channel sc = null;
        Channel cc = null;
        final SslHandler clientSslHandler = sslClientCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);
        final SslHandler serverSslHandler = sslServerCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);

        class SslEventHandler extends ChannelInboundHandlerAdapter {
            private final AtomicReference<SslHandshakeCompletionEvent> ref;

            SslEventHandler(AtomicReference<SslHandshakeCompletionEvent> ref) {
                this.ref = ref;
            }

            @Override
            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
                if (evt instanceof SslHandshakeCompletionEvent) {
                    ref.set((SslHandshakeCompletionEvent) evt);
                }
                super.userEventTriggered(ctx, evt);
            }
        }
        final AtomicReference<SslHandshakeCompletionEvent> clientEvent =
                new AtomicReference<SslHandshakeCompletionEvent>();
        final AtomicReference<SslHandshakeCompletionEvent> serverEvent =
                new AtomicReference<SslHandshakeCompletionEvent>();
        try {
            sc = new ServerBootstrap()
                    .group(group)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) throws Exception {
                            ch.pipeline().addLast(serverSslHandler);
                            ch.pipeline().addLast(new SslEventHandler(serverEvent));
                        }
                    })
                    .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();

            ChannelFuture future = new Bootstrap()
                    .group(group)
                    .channel(NioSocketChannel.class)
                    .handler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            ch.pipeline().addLast(clientSslHandler);
                            ch.pipeline().addLast(new SslEventHandler(clientEvent));
                        }
                    }).connect(sc.localAddress());
            cc = future.syncUninterruptibly().channel();

            Throwable clientCause = clientSslHandler.handshakeFuture().await().cause();
            assertInstanceOf(SSLException.class, clientCause);
            assertNull(clientCause.getCause());
            Throwable serverCause = serverSslHandler.handshakeFuture().await().cause();
            assertInstanceOf(SSLException.class, serverCause);

Domain

Subdomains

Frequently Asked Questions

What does testHandshakeFailureCipherMissmatch() do?
testHandshakeFailureCipherMissmatch() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java.
Where is testHandshakeFailureCipherMissmatch() defined?
testHandshakeFailureCipherMissmatch() is defined in handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java at line 1579.
What does testHandshakeFailureCipherMissmatch() call?
testHandshakeFailureCipherMissmatch() calls 2 function(s): SslEventHandler, userEventTriggered.
What calls testHandshakeFailureCipherMissmatch()?
testHandshakeFailureCipherMissmatch() is called by 4 function(s): testHandshakeFailureCipherMissmatchTLSv12Jdk, testHandshakeFailureCipherMissmatchTLSv12OpenSsl, testHandshakeFailureCipherMissmatchTLSv13Jdk, testHandshakeFailureCipherMissmatchTLSv13OpenSsl.

Analyze Your Own Codebase

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

Try Supermodel Free