Home / Function/ EmbeddedChannel() — netty Function Reference

EmbeddedChannel() — netty Function Reference

Architecture documentation for the EmbeddedChannel() function in CloseNotifyTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f32d201a_b88b_4d0d_0e9d_e795d6b90e14["EmbeddedChannel()"]
  91635dfc_456c_fec9_4413_a1ee45d49032["CloseNotifyTest"]
  f32d201a_b88b_4d0d_0e9d_e795d6b90e14 -->|defined in| 91635dfc_456c_fec9_4413_a1ee45d49032
  style f32d201a_b88b_4d0d_0e9d_e795d6b90e14 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java lines 148–184

    private static EmbeddedChannel initChannel(SslProvider provider, String protocol, final boolean useClientMode,
            final BlockingQueue<Object> eventQueue) throws Exception {

        SelfSignedCertificate ssc = CachedSelfSignedCertificate.getCachedCertificate();
        final SslContext sslContext = (useClientMode
                ? SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE)
                : SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()))
                 .sslProvider(provider)
                 .protocols(protocol)
                .build();
        // use sslContext.newHandler(ALLOC) instead of new SslHandler(sslContext.newEngine(ALLOC)) to create
        // non-JDK compatible OpenSSL engine that can process partial packets:
        SslHandler handler = sslContext.newHandler(ALLOC);
        // handler incremented the reference count and will destroy it when removed
        ReferenceCountUtil.release(sslContext);
        return new EmbeddedChannel(
                handler,
                new SimpleChannelInboundHandler<ByteBuf>() {

                    @Override
                    protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
                        eventQueue.add(msg.toString(US_ASCII));
                    }

                    @Override
                    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
                        eventQueue.add(evt);
                    }

                    @Override
                    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
                        eventQueue.add(INACTIVE);
                        super.channelInactive(ctx);
                    }
                }
        );
    }

Domain

Subdomains

Frequently Asked Questions

What does EmbeddedChannel() do?
EmbeddedChannel() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java.
Where is EmbeddedChannel() defined?
EmbeddedChannel() is defined in handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java at line 148.

Analyze Your Own Codebase

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

Try Supermodel Free