mirror of
https://git.krews.org/morningstar/nitrowebsockets-for-ms
synced 2025-02-22 05:32:36 +01:00
Update SSL handler
This commit is contained in:
parent
aff34551b5
commit
822f08cc11
@ -13,11 +13,13 @@ import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolConfig;
|
|||||||
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
import io.netty.handler.timeout.IdleStateHandler;
|
import io.netty.handler.ssl.SslHandler;
|
||||||
import org.krews.plugin.nitro.websockets.codec.WebSocketCodec;
|
import org.krews.plugin.nitro.websockets.codec.WebSocketCodec;
|
||||||
import org.krews.plugin.nitro.websockets.handlers.CustomHTTPHandler;
|
import org.krews.plugin.nitro.websockets.handlers.CustomHTTPHandler;
|
||||||
import org.krews.plugin.nitro.websockets.ssl.SSLCertificateLoader;
|
import org.krews.plugin.nitro.websockets.ssl.SSLCertificateLoader;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLEngine;
|
||||||
|
|
||||||
public class NetworkChannelInitializer extends ChannelInitializer<SocketChannel> {
|
public class NetworkChannelInitializer extends ChannelInitializer<SocketChannel> {
|
||||||
private static final int MAX_FRAME_SIZE = 500000;
|
private static final int MAX_FRAME_SIZE = 500000;
|
||||||
|
|
||||||
@ -40,7 +42,8 @@ public class NetworkChannelInitializer extends ChannelInitializer<SocketChannel>
|
|||||||
ch.pipeline().addLast("logger", new LoggingHandler());
|
ch.pipeline().addLast("logger", new LoggingHandler());
|
||||||
|
|
||||||
if(isSSL) {
|
if(isSSL) {
|
||||||
ch.pipeline().addLast(context.newHandler(ch.alloc()));
|
SSLEngine engine = context.newEngine(ch.alloc());
|
||||||
|
ch.pipeline().addLast(new SslHandler(engine));
|
||||||
}
|
}
|
||||||
ch.pipeline().addLast("httpCodec", new HttpServerCodec());
|
ch.pipeline().addLast("httpCodec", new HttpServerCodec());
|
||||||
ch.pipeline().addLast("objectAggregator", new HttpObjectAggregator(MAX_FRAME_SIZE));
|
ch.pipeline().addLast("objectAggregator", new HttpObjectAggregator(MAX_FRAME_SIZE));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user