1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.example.http.websocketx.sslserver;
17
18 import static org.jboss.netty.channel.Channels.*;
19
20 import javax.net.ssl.SSLEngine;
21
22 import org.jboss.netty.channel.ChannelPipeline;
23 import org.jboss.netty.channel.ChannelPipelineFactory;
24 import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
25 import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
26 import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
27 import org.jboss.netty.handler.ssl.SslHandler;
28
29
30
31 public class WebSocketSslServerPipelineFactory implements ChannelPipelineFactory {
32 public ChannelPipeline getPipeline() throws Exception {
33
34 ChannelPipeline pipeline = pipeline();
35
36 SSLEngine engine = WebSocketSslServerSslContext.getInstance().getServerContext().createSSLEngine();
37 engine.setUseClientMode(false);
38 pipeline.addLast("ssl", new SslHandler(engine));
39
40 pipeline.addLast("decoder", new HttpRequestDecoder());
41 pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
42 pipeline.addLast("encoder", new HttpResponseEncoder());
43 pipeline.addLast("handler", new WebSocketSslServerHandler());
44 return pipeline;
45 }
46 }