Update SSL handler

This commit is contained in:
ArpyAge 2025-02-11 00:47:57 +00:00
parent aff34551b5
commit 822f08cc11

View File

@ -13,11 +13,13 @@ import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolConfig;
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
import io.netty.handler.logging.LoggingHandler;
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.handlers.CustomHTTPHandler;
import org.krews.plugin.nitro.websockets.ssl.SSLCertificateLoader;
import javax.net.ssl.SSLEngine;
public class NetworkChannelInitializer extends ChannelInitializer<SocketChannel> {
private static final int MAX_FRAME_SIZE = 500000;
@ -40,7 +42,8 @@ public class NetworkChannelInitializer extends ChannelInitializer<SocketChannel>
ch.pipeline().addLast("logger", new LoggingHandler());
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("objectAggregator", new HttpObjectAggregator(MAX_FRAME_SIZE));