package com.manning.nettyinaction.chapter11;
import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.handler.ssl.SslHandler;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
public class SecureChatServerIntializer extends ChatServerInitializer {
private final SSLContext context;
public SecureChatServerIntializer(ChannelGroup group, SSLContext context) {
super(group);
this.context = context;
}
@Override
protected void initChannel(Channel ch) throws Exception {
super.initChannel(ch);
SSLEngine engine = context.createSSLEngine();
engine.setUseClientMode(false);
ch.pipeline().addFirst(new SslHandler(engine));
}
}