|
@@ -17,22 +17,18 @@ import org.holer.server.handler.ServerHandler;
|
|
|
|
|
|
public class ServerInitializer extends ChannelInitializer<SocketChannel> {
|
|
|
private boolean sslEnabled;
|
|
|
-
|
|
|
public ServerInitializer(boolean enabled) {
|
|
|
this.sslEnabled = enabled;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
protected void initChannel(SocketChannel sc) throws Exception {
|
|
|
if (this.sslEnabled) {
|
|
|
-
|
|
|
SSLContext sslCtx = SSLCreator.getCreator("conf/holer.jks").getSSLContext();
|
|
|
SSLEngine engine = sslCtx.createSSLEngine();
|
|
|
engine.setUseClientMode(false);
|
|
|
engine.setNeedClientAuth(true);
|
|
|
sc.pipeline().addLast("ssl", new SslHandler(engine));
|
|
|
}
|
|
|
-
|
|
|
sc.pipeline().addLast(new MsgDecoder(2097152, 0, 4, 0, 0));
|
|
|
sc.pipeline().addLast(new MsgEncoder());
|
|
|
sc.pipeline().addLast(new IdleChecker(60, 40, 0));
|