我正在尝试在 SSL (WSS) 之上运行 Netty Draft10 最新示例
我正在使用以下端口配置:
端口:80:Apache 非 ssl
端口:443:Apache ssl
端口:8080:Tomcat
端口:8877:Netty Web 非 SS
端口:9977:Netty SSL
但是当我嵌入 SSL 处理程序代码时
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
//TODO - Tamir - Add support for Wss
// Get the SslHandler in the current pipeline.
// We added it in SecureChatPipelineFactory.
final SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
// Get notified when SSL handshake is done.
ChannelFuture handshakeFuture = sslHandler.handshake();
handshakeFuture.addListener(new Greeter(sslHandler));
}
进入 WebSocketServerHandler 类我收到一条错误消息
java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:95)
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:68)
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:81)
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:198)
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:107)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:470)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:443)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:275)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:262)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:340)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:271)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:191)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
java.lang.IllegalArgumentException: invalid version format: ?_?_?__
这是我的管道代码
SSLEngine engine =
SecureChatSslContextFactory.getServerContext().createSSLEngine();
engine.setUseClientMode(false);
pipeline.addLast("ssl", new SslHandler(engine));
// On top of the SSL handler, add the text line codec.
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder());
// and then business logic.
pipeline.addLast("handler", new WebSocketServerHandler());
有任何想法吗?
干杯,
塔米尔