Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2012-08-01 12:59:50 -0400
committerJoakim Erdfelt2012-08-01 12:59:50 -0400
commit7c742ee4e81635de0fdd8c5fc930313f0a030243 (patch)
tree80af9635f9670ff9e7f101f745390da3477fab4d /jetty-websocket
parentab89924261bb2465a370929cb34917cef302b668 (diff)
downloadorg.eclipse.jetty.project-7c742ee4e81635de0fdd8c5fc930313f0a030243.tar.gz
org.eclipse.jetty.project-7c742ee4e81635de0fdd8c5fc930313f0a030243.tar.xz
org.eclipse.jetty.project-7c742ee4e81635de0fdd8c5fc930313f0a030243.zip
More AB tests around bad/reserved opcodes
Diffstat (limited to 'jetty-websocket')
-rw-r--r--jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java139
1 files changed, 139 insertions, 0 deletions
diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java
index 5c4e6c23f7..a270ea3094 100644
--- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java
@@ -151,4 +151,143 @@ public class TestABCase4 extends AbstractABCase
fuzzer.close();
}
}
+
+ /**
+ * Send opcode 11 (reserved)
+ */
+ @Test
+ public void testCase4_2_1() throws Exception
+ {
+ List<WebSocketFrame> send = new ArrayList<>();
+ send.add(new WebSocketFrame((byte)11)); // intentionally bad
+
+ List<WebSocketFrame> expect = new ArrayList<>();
+ expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
+
+ Fuzzer fuzzer = new Fuzzer(this);
+ try
+ {
+ fuzzer.connect();
+ fuzzer.setSendMode(Fuzzer.SendMode.BULK);
+ fuzzer.send(send);
+ fuzzer.expect(expect);
+ }
+ finally
+ {
+ fuzzer.close();
+ }
+ }
+
+ /**
+ * Send opcode 12 (reserved)
+ */
+ @Test
+ public void testCase4_2_2() throws Exception
+ {
+ List<WebSocketFrame> send = new ArrayList<>();
+ send.add(new WebSocketFrame((byte)12).setPayload("bad")); // intentionally bad
+
+ List<WebSocketFrame> expect = new ArrayList<>();
+ expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
+
+ Fuzzer fuzzer = new Fuzzer(this);
+ try
+ {
+ fuzzer.connect();
+ fuzzer.setSendMode(Fuzzer.SendMode.BULK);
+ fuzzer.send(send);
+ fuzzer.expect(expect);
+ }
+ finally
+ {
+ fuzzer.close();
+ }
+ }
+
+ /**
+ * Send small text, then frame with opcode 13 (reserved), then ping
+ */
+ @Test
+ public void testCase4_2_3() throws Exception
+ {
+ List<WebSocketFrame> send = new ArrayList<>();
+ send.add(WebSocketFrame.text("hello"));
+ send.add(new WebSocketFrame((byte)13)); // intentionally bad
+ send.add(WebSocketFrame.ping());
+
+ List<WebSocketFrame> expect = new ArrayList<>();
+ expect.add(WebSocketFrame.text("hello")); // echo
+ expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
+
+ Fuzzer fuzzer = new Fuzzer(this);
+ try
+ {
+ fuzzer.connect();
+ fuzzer.setSendMode(Fuzzer.SendMode.BULK);
+ fuzzer.send(send);
+ fuzzer.expect(expect);
+ }
+ finally
+ {
+ fuzzer.close();
+ }
+ }
+
+ /**
+ * Send small text, then frame with opcode 14 (reserved), then ping
+ */
+ @Test
+ public void testCase4_2_4() throws Exception
+ {
+ List<WebSocketFrame> send = new ArrayList<>();
+ send.add(WebSocketFrame.text("hello"));
+ send.add(new WebSocketFrame((byte)14).setPayload("bad")); // intentionally bad
+ send.add(WebSocketFrame.ping());
+
+ List<WebSocketFrame> expect = new ArrayList<>();
+ expect.add(WebSocketFrame.text("hello")); // echo
+ expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
+
+ Fuzzer fuzzer = new Fuzzer(this);
+ try
+ {
+ fuzzer.connect();
+ fuzzer.setSendMode(Fuzzer.SendMode.BULK);
+ fuzzer.send(send);
+ fuzzer.expect(expect);
+ }
+ finally
+ {
+ fuzzer.close();
+ }
+ }
+
+ /**
+ * Send small text, then frame with opcode 15 (reserved), then ping
+ */
+ @Test
+ public void testCase4_2_5() throws Exception
+ {
+ List<WebSocketFrame> send = new ArrayList<>();
+ send.add(WebSocketFrame.text("hello"));
+ send.add(new WebSocketFrame((byte)15).setPayload("bad")); // intentionally bad
+ send.add(WebSocketFrame.ping());
+
+ List<WebSocketFrame> expect = new ArrayList<>();
+ expect.add(WebSocketFrame.text("hello")); // echo
+ expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
+
+ Fuzzer fuzzer = new Fuzzer(this);
+ try
+ {
+ fuzzer.connect();
+ fuzzer.setSendMode(Fuzzer.SendMode.BULK);
+ fuzzer.send(send);
+ fuzzer.expect(expect);
+ }
+ finally
+ {
+ fuzzer.close();
+ }
+ }
}

Back to the top