Example usage for io.netty.channel ChannelPipeline channel

List of usage examples for io.netty.channel ChannelPipeline channel

Introduction

In this page you can find the example usage for io.netty.channel ChannelPipeline channel.

Prototype

Channel channel();

Source Link

Document

Returns the Channel that this pipeline is attached to.

Usage

From source file:reactor.ipc.netty.channel.ContextHandler.java

License:Open Source License

static void addSslAndLogHandlers(NettyOptions<?, ?> options, MonoSink<NettyContext> sink,
        LoggingHandler loggingHandler, boolean secure, ChannelPipeline pipeline) {
    SslHandler sslHandler = secure ? options.getSslHandler(pipeline.channel().alloc()) : null;
    if (sslHandler != null) {
        if (log.isDebugEnabled()) {
            log.debug("SSL enabled using engine {}", sslHandler.engine().getClass().getSimpleName());
        }// w w w.  j  a  v a2s . co  m
        if (log.isTraceEnabled()) {
            pipeline.addFirst(NettyPipeline.SslLoggingHandler, new LoggingHandler(SslReadHandler.class));
            pipeline.addAfter(NettyPipeline.SslLoggingHandler, NettyPipeline.SslHandler, sslHandler);
        } else {
            pipeline.addFirst(NettyPipeline.SslHandler, sslHandler);
        }
        if (log.isDebugEnabled()) {
            pipeline.addAfter(NettyPipeline.SslHandler, NettyPipeline.LoggingHandler, loggingHandler);
            pipeline.addAfter(NettyPipeline.LoggingHandler, NettyPipeline.SslReader, new SslReadHandler(sink));
        } else {
            pipeline.addAfter(NettyPipeline.SslHandler, NettyPipeline.SslReader, new SslReadHandler(sink));
        }
    } else if (log.isDebugEnabled()) {
        pipeline.addFirst(NettyPipeline.LoggingHandler, loggingHandler);
    }
}