Home / Function/ testKeyTypeChange() — netty Function Reference

testKeyTypeChange() — netty Function Reference

Architecture documentation for the testKeyTypeChange() function in QuicChannelConnectTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cab6a9ed_69b9_9dfe_4c57_eacd1b8d5cd3["testKeyTypeChange()"]
  1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"]
  cab6a9ed_69b9_9dfe_4c57_eacd1b8d5cd3 -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663
  style cab6a9ed_69b9_9dfe_4c57_eacd1b8d5cd3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 736–802

    @ParameterizedTest
    @MethodSource("newSslTaskExecutors")
    public void testKeyTypeChange(Executor executor) throws Throwable {
        final CountDownLatch readLatch = new CountDownLatch(1);
        Map<String, String> serverKeyTypes = new HashMap<>();
        serverKeyTypes.put("RSA", "RSA");

        Set<String> clientKeyTypes = new HashSet<>();
        clientKeyTypes.add("RSA");

        Channel server = QuicTestUtils.newServer(QuicTestUtils.newQuicServerBuilder(executor,
                        QuicSslContextBuilder.forServer(
                                        QuicTestUtils.SELF_SIGNED_CERTIFICATE.privateKey(), null,
                                        QuicTestUtils.SELF_SIGNED_CERTIFICATE.certificate())
                                .applicationProtocols(QuicTestUtils.PROTOS)
                                .option(BoringSSLContextOption.SERVER_KEY_TYPES, serverKeyTypes)
                                .earlyData(true)
                                .build()),
                TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter() {
                    @Override
                    public boolean isSharable() {
                        return true;
                    }
                }, new ByteToMessageDecoder() {
                    protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
                        if (msg.readableBytes() < 4) {
                            return;
                        }
                        assertEquals(5, msg.readInt());
                        readLatch.countDown();
                        ctx.close();
                    }
                });

        InetSocketAddress address = (InetSocketAddress) server.localAddress();

        QuicSslContext sslContext = QuicSslContextBuilder.forClient()
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .applicationProtocols(QuicTestUtils.PROTOS)
                .option(BoringSSLContextOption.CLIENT_KEY_TYPES, clientKeyTypes)
                .earlyData(true)
                .build();

        Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor, sslContext)
                .sslEngineProvider(q -> sslContext.newEngine(q.alloc(), "localhost", 9999)));

        try {
            QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
                    .streamHandler(new ChannelInboundHandlerAdapter())
                    .remoteAddress(address)
                    .connect()
                    .get();
            quicChannel.createStream(QuicStreamType.BIDIRECTIONAL,
                    new ChannelInboundHandlerAdapter()).addListener(f -> {
                        Channel stream = (Channel) f.getNow();
                        stream.writeAndFlush(stream.alloc().buffer().writeInt(5));
            }).await().addListener(f -> {
                assertTrue(f.isSuccess());
            });

            readLatch.await();
        } finally {
            server.close().sync();
            channel.close().sync();
            shutdown(executor);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testKeyTypeChange() do?
testKeyTypeChange() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java.
Where is testKeyTypeChange() defined?
testKeyTypeChange() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java at line 736.

Analyze Your Own Codebase

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

Try Supermodel Free