diff --git a/example/src/main/java/io/netty/example/http/websocketx/autobahn/package-info.java b/example/src/main/java/io/netty/example/http/websocketx/autobahn/package-info.java index 892442c725..971d1f0640 100644 --- a/example/src/main/java/io/netty/example/http/websocketx/autobahn/package-info.java +++ b/example/src/main/java/io/netty/example/http/websocketx/autobahn/package-info.java @@ -26,13 +26,14 @@ * *

03. Intall Python Setup Tools: sudo apt-get install python-setuptools * - *

04. Install AutoBahn: sudo easy_install Autobahn + *

04. Install AutoBahn: sudo easy_install Autobahn. If you already have Autobahn installed, you may need + * to upgrade it: sudo easy_install --upgrade Autobahn. Make suer v0.4.10 is installed. * - *

05. Get AutoBahn testsuite source code: git clone git@github.com:oberstet/Autobahn.git + *

05. Get AutoBahn testsuite source code: git clone git@github.com:tavendo/AutobahnPython.git * - *

06. Go to AutoBahn directory: cd Autobahn + *

06. Go to AutoBahn directory: cd AutobahnPython * - *

07. Checkout stable version: git checkout v0.4.3 + *

07. Checkout stable version: git checkout v0.4.10 * *

08. Go to test suite directory: cd testsuite/websockets * @@ -47,11 +48,12 @@ * } * * - *

10. Run AutobahnServer in this package + *

10. Run our AutobahnServer located in this package. If you are in Eclipse IDE, right click on + * AutobahnServer.java and select Run As > Java Application. * - *

11. Run the test python fuzzing_client.py. Note that the actual test case python code is - * located in /usr/local/lib/python2.6/dist-packages/autobahn-0.4.3-py2.6.egg/autobahn/cases - * and not in the checked out git repository. + *

11. Run the Autobahn test python fuzzing_client.py. Note that the actual test case python code is + * located with the easy_install package (e.g. in /usr/local/lib/python2.7/dist-packages/ + * autobahn-0.4.10-py2.7.egg/autobahn/cases) and not in the checked out git repository. * *

12. See the results in reports/servers/index.html */ diff --git a/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketClient.java b/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketClient.java index 9dc282eb52..f86295a408 100644 --- a/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketClient.java +++ b/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketClient.java @@ -84,7 +84,7 @@ public class WebSocketClient { HashMap customHeaders = new HashMap(); customHeaders.put("MyHeader", "MyValue"); - // Connect with V13 (RFC 6455). You can change it to V08 or V00. + // Connect with V13 (RFC 6455 aka HyBi-17). You can change it to V08 or V00. // If you change it to V00, ping is not supported and remember to change // HttpResponseDecoder to WebSocketHttpResponseDecoder in the pipeline. final WebSocketClientHandshaker handshaker = @@ -94,12 +94,7 @@ public class WebSocketClient { bootstrap.setPipelineFactory(new ChannelPipelineFactory() { public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); - - // If you wish to support HyBi V00, you need to use - // WebSocketHttpResponseDecoder instead for - // HttpResponseDecoder. pipeline.addLast("decoder", new HttpResponseDecoder()); - pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("ws-handler", new WebSocketClientHandler(handshaker)); return pipeline; diff --git a/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketHttpResponseDecoder.java b/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketHttpResponseDecoder.java deleted file mode 100644 index 850054c429..0000000000 --- a/example/src/main/java/io/netty/example/http/websocketx/client/WebSocketHttpResponseDecoder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.example.http.websocketx.client; - -import io.netty.handler.codec.http.HttpMessage; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseDecoder; - -/** - * Fix bug in standard HttpResponseDecoder for web socket clients. When status 101 is received for Hybi00, there are 16 - * bytes of contents expected - */ -public class WebSocketHttpResponseDecoder extends HttpResponseDecoder { - - @Override - protected boolean isContentAlwaysEmpty(HttpMessage msg) { - if (msg instanceof HttpResponse) { - HttpResponse res = (HttpResponse) msg; - int code = res.getStatus().getCode(); - - // FIX force reading of protocol upgrade challenge data into the content buffer - if (code == 101) { - return false; - } - - if (code < 200) { - return true; - } - switch (code) { - case 204: - case 205: - case 304: - return true; - } - } - return false; - } -} diff --git a/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServer.java b/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServer.java index d0918c4ec1..2225455a10 100644 --- a/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServer.java +++ b/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServer.java @@ -37,6 +37,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannelFactory; *

  • Chrome 14+ (draft-ietf-hybi-thewebsocketprotocol-10) *
  • Chrome 16+ (RFC 6455 aka draft-ietf-hybi-thewebsocketprotocol-17) *
  • Firefox 7+ (draft-ietf-hybi-thewebsocketprotocol-10) + *
  • Firefox 11+ (RFC 6455 aka draft-ietf-hybi-thewebsocketprotocol-17) * */ public class WebSocketServer {