Browse Source

Merge pull request #190 from ganeshs/master

Refactored initChannel to allow subclasses customize the channel handlers
master
Nikita Koksharov 10 years ago
parent
commit
799e32f720
  1. 24
      src/main/java/com/corundumstudio/socketio/SocketIOChannelInitializer.java

24
src/main/java/com/corundumstudio/socketio/SocketIOChannelInitializer.java

@ -135,14 +135,30 @@ public class SocketIOChannelInitializer extends ChannelInitializer<Channel> impl
@Override
protected void initChannel(Channel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
if (sslContext != null) {
addSslHandler(pipeline);
addSocketioHandlers(pipeline);
}
/**
* Adds the ssl handler
*
* @return
*/
protected void addSslHandler(ChannelPipeline pipeline) {
if (sslContext != null) {
SSLEngine engine = sslContext.createSSLEngine();
engine.setUseClientMode(false);
pipeline.addLast(SSL_HANDLER, new SslHandler(engine));
}
pipeline.addLast(HTTP_REQUEST_DECODER, new HttpRequestDecoder());
}
/**
* Adds the socketio channel handlers
*
* @param pipeline
*/
protected void addSocketioHandlers(ChannelPipeline pipeline) {
pipeline.addLast(HTTP_REQUEST_DECODER, new HttpRequestDecoder());
pipeline.addLast(HTTP_AGGREGATOR, new HttpObjectAggregator(configuration.getMaxHttpContentLength()));
pipeline.addLast(HTTP_ENCODER, new HttpResponseEncoder());

Loading…
Cancel
Save