diff --git a/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServer.java b/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServer.java index a0bcd9b001..c491b43235 100644 --- a/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServer.java +++ b/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServer.java @@ -36,13 +36,10 @@ import io.netty.channel.socket.nio.NioServerSocketChannelFactory; * * */ public class WebSocketSslServer { diff --git a/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java b/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java index 04473624f7..21d5bade2c 100644 --- a/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java +++ b/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java @@ -38,41 +38,41 @@ import org.junit.Test; public class WebSocketServerHandshaker13Test { - private DefaultChannelPipeline createPipeline() { - DefaultChannelPipeline pipeline = new DefaultChannelPipeline(); - pipeline.addLast("chunkAggregator", new HttpChunkAggregator(42)); - pipeline.addLast("requestDecoder", new HttpRequestDecoder()); - pipeline.addLast("responseEncoder", new HttpResponseEncoder()); - return pipeline; - } + private DefaultChannelPipeline createPipeline() { + DefaultChannelPipeline pipeline = new DefaultChannelPipeline(); + pipeline.addLast("chunkAggregator", new HttpChunkAggregator(42)); + pipeline.addLast("requestDecoder", new HttpRequestDecoder()); + pipeline.addLast("responseEncoder", new HttpResponseEncoder()); + return pipeline; + } - @Test - public void testPerformOpeningHandshake() { - Channel channelMock = EasyMock.createMock(Channel.class); + @Test + public void testPerformOpeningHandshake() { + Channel channelMock = EasyMock.createMock(Channel.class); - DefaultChannelPipeline pipeline = createPipeline(); - EasyMock.expect(channelMock.getPipeline()).andReturn(pipeline); + DefaultChannelPipeline pipeline = createPipeline(); + EasyMock.expect(channelMock.getPipeline()).andReturn(pipeline); - // capture the http response in order to verify the headers - Capture res = new Capture(); - EasyMock.expect(channelMock.write(capture(res))).andReturn(new DefaultChannelFuture(channelMock, true)); + // capture the http response in order to verify the headers + Capture res = new Capture(); + EasyMock.expect(channelMock.write(capture(res))).andReturn(new DefaultChannelFuture(channelMock, true)); - replay(channelMock); + replay(channelMock); - HttpRequest req = new DefaultHttpRequest(HTTP_1_1, HttpMethod.GET, "/chat"); - req.setHeader(Names.HOST, "server.example.com"); - req.setHeader(Names.UPGRADE, WEBSOCKET.toLowerCase()); - req.setHeader(Names.CONNECTION, "Upgrade"); - req.setHeader(Names.SEC_WEBSOCKET_KEY, "dGhlIHNhbXBsZSBub25jZQ=="); - req.setHeader(Names.SEC_WEBSOCKET_ORIGIN, "http://example.com"); - req.setHeader(Names.SEC_WEBSOCKET_PROTOCOL, "chat, superchat"); - req.setHeader(Names.SEC_WEBSOCKET_VERSION, "13"); + HttpRequest req = new DefaultHttpRequest(HTTP_1_1, HttpMethod.GET, "/chat"); + req.setHeader(Names.HOST, "server.example.com"); + req.setHeader(Names.UPGRADE, WEBSOCKET.toLowerCase()); + req.setHeader(Names.CONNECTION, "Upgrade"); + req.setHeader(Names.SEC_WEBSOCKET_KEY, "dGhlIHNhbXBsZSBub25jZQ=="); + req.setHeader(Names.SEC_WEBSOCKET_ORIGIN, "http://example.com"); + req.setHeader(Names.SEC_WEBSOCKET_PROTOCOL, "chat, superchat"); + req.setHeader(Names.SEC_WEBSOCKET_VERSION, "13"); - WebSocketServerHandshaker13 handsaker13 = new WebSocketServerHandshaker13("ws://example.com/chat", "chat", - false); - handsaker13.performOpeningHandshake(channelMock, req); + WebSocketServerHandshaker13 handsaker13 = new WebSocketServerHandshaker13("ws://example.com/chat", "chat", + false); + handsaker13.performOpeningHandshake(channelMock, req); - Assert.assertEquals("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=", res.getValue().getHeader(Names.SEC_WEBSOCKET_ACCEPT)); - Assert.assertEquals("chat", res.getValue().getHeader(Names.SEC_WEBSOCKET_PROTOCOL)); - } + Assert.assertEquals("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=", res.getValue().getHeader(Names.SEC_WEBSOCKET_ACCEPT)); + Assert.assertEquals("chat", res.getValue().getHeader(Names.SEC_WEBSOCKET_PROTOCOL)); + } }