@Override protected void decode(ChannelHandlerContext context, ByteBuf in, List<Object> out) { // minimum bytes required to detect ssl if (in.readableBytes() < SSL_RECORD_HEADER_LENGTH) { return; } ChannelPipeline pipeline = context.pipeline(); if (isTls(in, in.readerIndex())) { pipeline.replace(this, "ssl", sslContext.newHandler(context.alloc())); } else { pipeline.remove(this); } }
@Override protected void initChannel(SocketChannel channel) { ChannelPipeline pipeline = channel.pipeline(); if (sslContextSupplier.isPresent()) { if (allowPlainText) { pipeline.addLast(new OptionalSslHandler(sslContextSupplier.get().get())); } else { pipeline.addLast(sslContextSupplier.get().get().newHandler(channel.alloc())); } } pipeline.addLast(new ThriftProtocolDetection( new ThriftServerHandler(methodInvoker, requestTimeout, timeoutExecutor), maxFrameSize, assumeClientsSupportOutOfOrderResponses)); } }
@Override protected void initChannel(SocketChannel channel) { ChannelPipeline pipeline = channel.pipeline(); if (sslContextSupplier.isPresent()) { if (allowPlainText) { pipeline.addLast(new OptionalSslHandler(sslContextSupplier.get().get())); } else { pipeline.addLast(sslContextSupplier.get().get().newHandler(channel.alloc())); } } pipeline.addLast(new ThriftProtocolDetection( new ThriftServerHandler(methodInvoker, requestTimeout, timeoutExecutor), maxFrameSize, assumeClientsSupportOutOfOrderResponses)); } }
@Override protected void decode(ChannelHandlerContext context, ByteBuf in, List<Object> out) { // minimum bytes required to detect ssl if (in.readableBytes() < SSL_RECORD_HEADER_LENGTH) { return; } ChannelPipeline pipeline = context.pipeline(); if (isTls(in, in.readerIndex())) { pipeline.replace(this, "ssl", sslContext.newHandler(context.alloc())); } else { pipeline.remove(this); } }