use of com.linkedin.r2.netty.handler.common.SessionResumptionSslHandler in project rest.li by linkedin.
the class HttpChannelInitializer method initChannel.
@Override
protected void initChannel(NioSocketChannel channel) {
if (_ssl) {
channel.pipeline().addLast(SessionResumptionSslHandler.PIPELINE_SESSION_RESUMPTION_HANDLER, new SessionResumptionSslHandler(_sslContext, _sslParameters, _enableSSLSessionResumption, _sslHandShakeTimeout));
}
channel.pipeline().addLast("codec", new HttpClientCodec(_maxInitialLineLength, _maxHeaderSize, _maxChunkSize));
channel.pipeline().addLast("outboundRestRequestEncoder", HttpMessageEncoders.newRestRequestEncoder());
channel.pipeline().addLast("outboundStreamDataEncoder", HttpMessageEncoders.newDataEncoder());
channel.pipeline().addLast("outboundStreamRequestEncoder", HttpMessageEncoders.newStreamRequestEncoder());
channel.pipeline().addLast("inboundDataDecoder", HttpMessageDecoders.newDataDecoder());
channel.pipeline().addLast("inboundRequestDecoder", HttpMessageDecoders.newResponseDecoder());
channel.pipeline().addLast("schemeHandler", new SchemeHandler(_ssl ? HttpScheme.HTTPS.toString() : HttpScheme.HTTP.toString()));
channel.pipeline().addLast("streamDuplexHandler", new ClientEntityStreamHandler(_maxContentLength));
channel.pipeline().addLast("timeoutHandler", new CancelTimeoutHandler());
channel.pipeline().addLast("channelPoolHandler", new ChannelLifecycleHandler(RECYCLE_CHANNEL));
}
use of com.linkedin.r2.netty.handler.common.SessionResumptionSslHandler in project rest.li by linkedin.
the class RAPStreamClientPipelineInitializer method initChannel.
@Override
protected void initChannel(NioSocketChannel ch) {
if (_sslContext != null) {
ch.pipeline().addLast(SessionResumptionSslHandler.PIPELINE_SESSION_RESUMPTION_HANDLER, new SessionResumptionSslHandler(_sslContext, _sslParameters, _enableSSLSessionResumption, _sslHandShakeTimeout));
}
ch.pipeline().addLast("codec", new HttpClientCodec(4096, _maxHeaderSize, _maxChunkSize));
ch.pipeline().addLast("rapFullRequestEncoder", new RAPStreamFullRequestEncoder());
ch.pipeline().addLast("rapEncoder", new RAPStreamRequestEncoder());
ch.pipeline().addLast("rapDecoder", new RAPStreamResponseDecoder(_maxResponseSize));
// the response handler catches the exceptions thrown by other layers. By consequence no handlers that throw exceptions
// should be after this one, otherwise the exception won't be caught and managed by R2
ch.pipeline().addLast("responseHandler", new RAPStreamResponseHandler());
ch.pipeline().addLast("channelManager", new ChannelPoolStreamHandler());
}
use of com.linkedin.r2.netty.handler.common.SessionResumptionSslHandler in project rest.li by linkedin.
the class Http2ChannelInitializer method configureSsl.
/**
* Configure the pipeline for TLS ALPN negotiation to HTTP/2.
*/
private void configureSsl(NioSocketChannel channel) throws SSLException {
final SslContext sslCtx = createSslContext();
final ChannelPromise alpnPromise = channel.newPromise();
channel.attr(NettyChannelAttributes.INITIALIZATION_FUTURE).set(alpnPromise);
channel.pipeline().addLast(SessionResumptionSslHandler.PIPELINE_SESSION_RESUMPTION_HANDLER, new SessionResumptionSslHandler(sslCtx, _enableSSLSessionResumption, _sslHandShakeTimeout));
channel.pipeline().addLast(new Http2AlpnHandler(alpnPromise, createHttp2Settings()));
}
use of com.linkedin.r2.netty.handler.common.SessionResumptionSslHandler in project rest.li by linkedin.
the class Http2AlpnHandler method handlerAdded.
@Override
public void handlerAdded(ChannelHandlerContext ctx) {
_alpnPromise = ctx.channel().newPromise();
// the class will take care of establishing the SSL connection
ctx.pipeline().addFirst(SessionResumptionSslHandler.PIPELINE_SESSION_RESUMPTION_HANDLER, new SessionResumptionSslHandler(_sslContext, _enableSSLSessionResumption, _sslHandShakeTimeout));
// Fail the ALPN promise when channel is closed
ctx.channel().closeFuture().addListener(future -> {
if (!_alpnPromise.isDone()) {
_alpnPromise.setFailure(new ChannelException("HTTP/2 ALPN did not complete before channel closed"));
}
});
}
Aggregations