diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java index b1fed4bf12e..caed2665aee 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java @@ -274,7 +274,7 @@ public class WebSocketRemoteEndpoint implements RemoteEndpoint { LOG.debug("sendPing with {}",BufferUtil.toDetailString(applicationData)); } - blockingWrite(new PingFrame(applicationData)); + blockingWrite(new PingFrame().setPayload(applicationData)); } finally { @@ -300,7 +300,7 @@ public class WebSocketRemoteEndpoint implements RemoteEndpoint { LOG.debug("sendPong with {}",BufferUtil.toDetailString(applicationData)); } - blockingWrite(new PongFrame(applicationData)); + blockingWrite(new PongFrame().setPayload(applicationData)); } finally { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PingFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PingFrame.java index a2ead275c18..59ffac8d749 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PingFrame.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PingFrame.java @@ -30,21 +30,16 @@ public class PingFrame extends ControlFrame super(OpCode.PING); } - public PingFrame(ByteBuffer buf) + public PingFrame setPayload(byte[] bytes) { - this(); - setPayload(buf); - } - - public PingFrame(byte[] bytes) - { - this(); setPayload(ByteBuffer.wrap(bytes)); + return this; } - public PingFrame(String payload) + public PingFrame setPayload(String payload) { - this(StringUtil.getUtf8Bytes(payload)); + setPayload(StringUtil.getUtf8Bytes(payload)); + return this; } @Override diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PongFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PongFrame.java index d5d533919f3..b3a1ca1d49f 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PongFrame.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/frames/PongFrame.java @@ -30,21 +30,16 @@ public class PongFrame extends ControlFrame super(OpCode.PONG); } - public PongFrame(ByteBuffer buf) + public PongFrame setPayload(byte[] bytes) { - this(); - setPayload(buf); - } - - public PongFrame(byte[] bytes) - { - this(); setPayload(ByteBuffer.wrap(bytes)); + return this; } - public PongFrame(String payload) + public PongFrame setPayload(String payload) { - this(StringUtil.getUtf8Bytes(payload)); + setPayload(StringUtil.getUtf8Bytes(payload)); + return this; } @Override diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java index be2fa8ca17d..55777f3675f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java @@ -216,7 +216,7 @@ public class GeneratorTest WebSocketFrame[] frames = new WebSocketFrame[pingCount + 1]; for (int i = 0; i < pingCount; i++) { - frames[i] = new PingFrame(String.format("ping-%d",i)); + frames[i] = new PingFrame().setPayload(String.format("ping-%d",i)); } frames[pingCount] = new CloseInfo(StatusCode.NORMAL).asFrame(); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java index 7319c0cae46..6e1e687a978 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java @@ -94,10 +94,10 @@ public class ParserTest List send = new ArrayList<>(); send.add(new TextFrame("f1").setFin(false)); send.add(new ContinuationFrame(",f2").setFin(false)); - send.add(new PingFrame("pong-1")); + send.add(new PingFrame().setPayload("pong-1")); send.add(new ContinuationFrame(",f3").setFin(false)); send.add(new ContinuationFrame(",f4").setFin(false)); - send.add(new PingFrame("pong-2")); + send.add(new PingFrame().setPayload("pong-2")); send.add(new ContinuationFrame(",f5").setFin(true)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -121,7 +121,7 @@ public class ParserTest public void testParseCase5_6() { List send = new ArrayList<>(); - send.add(new PongFrame("ping")); + send.add(new PongFrame().setPayload("ping")); send.add(new TextFrame("hello, world")); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java index ab8bbc343df..0f1ad6d43c4 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java @@ -61,7 +61,7 @@ public class RFC6455ExamplesGeneratorTest @Test public void testSingleMaskedPongRequest() { - PongFrame pong = new PongFrame("Hello"); + PongFrame pong = new PongFrame().setPayload("Hello"); pong.setMask(new byte[] { 0x37, (byte)0xfa, 0x21, 0x3d }); @@ -158,7 +158,7 @@ public class RFC6455ExamplesGeneratorTest @Test public void testSingleUnmaskedPingRequest() throws Exception { - PingFrame ping = new PingFrame("Hello"); + PingFrame ping = new PingFrame().setPayload("Hello"); ByteBuffer actual = UnitGenerator.generate(ping); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java index 4ccc9be7dae..ca9fcc8c7bd 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java @@ -55,7 +55,7 @@ public class TestABCase2 bytes[i] = Integer.valueOf(Integer.toOctalString(i)).byteValue(); } - PingFrame pingFrame = new PingFrame(bytes); + WebSocketFrame pingFrame = new PingFrame().setPayload(bytes); ByteBuffer actual = UnitGenerator.generate(pingFrame); @@ -79,7 +79,7 @@ public class TestABCase2 { byte[] bytes = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; - PingFrame pingFrame = new PingFrame(bytes); + PingFrame pingFrame = new PingFrame().setPayload(bytes); ByteBuffer actual = UnitGenerator.generate(pingFrame); @@ -122,7 +122,7 @@ public class TestABCase2 String message = "Hello, world!"; byte[] messageBytes = StringUtil.getUtf8Bytes(message); - PingFrame pingFrame = new PingFrame(messageBytes); + PingFrame pingFrame = new PingFrame().setPayload(messageBytes); ByteBuffer actual = UnitGenerator.generate(pingFrame); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java index 1998828f285..39800f52f74 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java @@ -26,7 +26,6 @@ import org.eclipse.jetty.websocket.api.WebSocketException; import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.common.CloseInfo; -import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.BinaryFrame; import org.eclipse.jetty.websocket.common.frames.PingFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; @@ -116,7 +115,7 @@ public class EventDriverTest try (LocalWebSocketSession conn = new LocalWebSocketSession(testname,driver)) { conn.open(); - driver.incomingFrame(new PingFrame("PING")); + driver.incomingFrame(new PingFrame().setPayload("PING")); driver.incomingFrame(new TextFrame("Text Me")); driver.incomingFrame(new BinaryFrame("Hello Bin")); driver.incomingFrame(new CloseInfo(StatusCode.SHUTDOWN,"testcase").asFrame()); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java index 5aefccb1106..8f05db9224f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java @@ -115,7 +115,7 @@ public class FragmentExtensionTest ext.setNextIncomingFrames(capture); String payload = "Are you there?"; - Frame ping = new PingFrame(payload); + Frame ping = new PingFrame().setPayload(payload); ext.incomingFrame(ping); capture.assertFrameCount(1); @@ -286,7 +286,7 @@ public class FragmentExtensionTest ext.setNextOutgoingFrames(capture); String payload = "Are you there?"; - Frame ping = new PingFrame(payload); + Frame ping = new PingFrame().setPayload(payload); ext.outgoingFrame(ping,null); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/MessageCompressionExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/MessageCompressionExtensionTest.java index ed13e3f1661..05658e6b30f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/MessageCompressionExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/MessageCompressionExtensionTest.java @@ -177,7 +177,7 @@ public class MessageCompressionExtensionTest ext.setNextIncomingFrames(capture); String payload = "Are you there?"; - Frame ping = new PingFrame(payload); + Frame ping = new PingFrame().setPayload(payload); ext.incomingFrame(ping); capture.assertFrameCount(1); @@ -339,7 +339,7 @@ public class MessageCompressionExtensionTest ext.setNextOutgoingFrames(capture); String payload = "Are you there?"; - Frame ping = new PingFrame(payload); + Frame ping = new PingFrame().setPayload(payload); ext.outgoingFrame(ping,null); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/WriteBytesProviderTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/WriteBytesProviderTest.java index 62cda9e8151..97b68eb6435 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/WriteBytesProviderTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/WriteBytesProviderTest.java @@ -31,7 +31,6 @@ import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.common.CloseInfo; import org.eclipse.jetty.websocket.common.Hex; import org.eclipse.jetty.websocket.common.UnitGenerator; -import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.BinaryFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; import org.junit.Assert; diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java index 94922db5cff..593cf8b477e 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java @@ -82,8 +82,8 @@ public class TestABCase2 extends AbstractABCase for (int i = 0; i < pingCount; i++) { String payload = String.format("ping-%d[%X]",i,i); - send.add(new PingFrame(payload)); - expect.add(new PongFrame(payload)); + send.add(new PingFrame().setPayload(payload)); + expect.add(new PongFrame().setPayload(payload)); } send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -121,8 +121,8 @@ public class TestABCase2 extends AbstractABCase for (int i = 0; i < pingCount; i++) { String payload = String.format("ping-%d[%X]",i,i); - send.add(new PingFrame(payload)); - expect.add(new PongFrame(payload)); + send.add(new PingFrame().setPayload(payload)); + expect.add(new PongFrame().setPayload(payload)); } send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -151,11 +151,11 @@ public class TestABCase2 extends AbstractABCase byte payload[] = StringUtil.getUtf8Bytes("Hello world"); List send = new ArrayList<>(); - send.add(new PingFrame(payload)); + send.add(new PingFrame().setPayload(payload)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame(copyOf(payload))); + expect.add(new PongFrame().setPayload(copyOf(payload))); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); Fuzzer fuzzer = new Fuzzer(this); @@ -182,11 +182,11 @@ public class TestABCase2 extends AbstractABCase { 0x00, (byte)0xFF, (byte)0xFE, (byte)0xFD, (byte)0xFC, (byte)0xFB, 0x00, (byte)0xFF }; List send = new ArrayList<>(); - send.add(new PingFrame(payload)); + send.add(new PingFrame().setPayload(payload)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame(copyOf(payload))); + expect.add(new PongFrame().setPayload(copyOf(payload))); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); Fuzzer fuzzer = new Fuzzer(this); @@ -213,11 +213,11 @@ public class TestABCase2 extends AbstractABCase Arrays.fill(payload,(byte)0xFE); List send = new ArrayList<>(); - send.add(new PingFrame(payload)); + send.add(new PingFrame().setPayload(payload)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame(copyOf(payload))); + expect.add(new PongFrame().setPayload(copyOf(payload))); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); Fuzzer fuzzer = new Fuzzer(this); @@ -280,11 +280,11 @@ public class TestABCase2 extends AbstractABCase Arrays.fill(payload,(byte)'6'); List send = new ArrayList<>(); - send.add(new PingFrame(payload)); + send.add(new PingFrame().setPayload(payload)); send.add(new CloseInfo(StatusCode.NORMAL,"Test 2.6").asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame(copyOf(payload))); + expect.add(new PongFrame().setPayload(copyOf(payload))); expect.add(new CloseInfo(StatusCode.NORMAL,"Test 2.6").asFrame()); Fuzzer fuzzer = new Fuzzer(this); @@ -336,7 +336,7 @@ public class TestABCase2 extends AbstractABCase public void testCase2_8() throws Exception { List send = new ArrayList<>(); - send.add(new PongFrame("unsolicited")); // unsolicited pong + send.add(new PongFrame().setPayload("unsolicited")); // unsolicited pong send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); @@ -363,12 +363,12 @@ public class TestABCase2 extends AbstractABCase public void testCase2_9() throws Exception { List send = new ArrayList<>(); - send.add(new PongFrame("unsolicited")); // unsolicited pong - send.add(new PingFrame("our ping")); // our ping + send.add(new PongFrame().setPayload("unsolicited")); // unsolicited pong + send.add(new PingFrame().setPayload("our ping")); // our ping send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame("our ping")); // our pong + expect.add(new PongFrame().setPayload("our ping")); // our pong expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); Fuzzer fuzzer = new Fuzzer(this); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java index 6f14f48deea..9af659339ea 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java @@ -71,7 +71,7 @@ public class TestABCase3 extends AbstractABCase List send = new ArrayList<>(); send.add(new TextFrame().setPayload("small")); send.add(new TextFrame().setPayload("small").setRsv2(true)); // intentionally bad - send.add(new PingFrame("ping")); + send.add(new PingFrame().setPayload("ping")); List expect = new ArrayList<>(); expect.add(new TextFrame().setPayload("small")); // echo on good frame @@ -100,7 +100,7 @@ public class TestABCase3 extends AbstractABCase List send = new ArrayList<>(); send.add(new TextFrame().setPayload("small")); send.add(new TextFrame().setPayload("small").setRsv1(true).setRsv2(true)); // intentionally bad - send.add(new PingFrame("ping")); + send.add(new PingFrame().setPayload("ping")); List expect = new ArrayList<>(); expect.add(new TextFrame().setPayload("small")); // echo on good frame @@ -129,7 +129,7 @@ public class TestABCase3 extends AbstractABCase List send = new ArrayList<>(); send.add(new TextFrame().setPayload("small")); send.add(new TextFrame().setPayload("small").setRsv3(true)); // intentionally bad - send.add(new PingFrame("ping")); + send.add(new PingFrame().setPayload("ping")); List expect = new ArrayList<>(); expect.add(new TextFrame().setPayload("small")); // echo on good frame @@ -189,7 +189,7 @@ public class TestABCase3 extends AbstractABCase Arrays.fill(payload,(byte)0xFF); List send = new ArrayList<>(); - send.add(new PingFrame(payload).setRsv3(true).setRsv2(true)); // intentionally bad + send.add(new PingFrame().setPayload(payload).setRsv3(true).setRsv2(true)); // intentionally bad List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java index c1777e3a861..de530833929 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java @@ -49,7 +49,7 @@ public class TestABCase5 extends AbstractABCase public void testCase5_1() throws Exception { List send = new ArrayList<>(); - send.add(new PingFrame("hello, ").setFin(false)); + send.add(new PingFrame().setPayload("hello, ").setFin(false)); send.add(new ContinuationFrame("world")); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -346,21 +346,21 @@ public class TestABCase5 extends AbstractABCase List send1 = new ArrayList<>(); send1.add(new TextFrame("f1").setFin(false)); send1.add(new ContinuationFrame(",f2").setFin(false)); - send1.add(new PingFrame("pong-1")); + send1.add(new PingFrame().setPayload("pong-1")); List expect1 = new ArrayList<>(); - expect1.add(new PongFrame("pong-1")); + expect1.add(new PongFrame().setPayload("pong-1")); // phase 2 List send2 = new ArrayList<>(); send2.add(new ContinuationFrame(",f3").setFin(false)); send2.add(new ContinuationFrame(",f4").setFin(false)); - send2.add(new PingFrame("pong-2")); + send2.add(new PingFrame().setPayload("pong-2")); send2.add(new ContinuationFrame(",f5").setFin(true)); send2.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect2 = new ArrayList<>(); - expect2.add(new PongFrame("pong-2")); + expect2.add(new PongFrame().setPayload("pong-2")); expect2.add(new TextFrame().setPayload("f1,f2,f3,f4,f5")); expect2.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -394,7 +394,7 @@ public class TestABCase5 extends AbstractABCase public void testCase5_2() throws Exception { List send = new ArrayList<>(); - send.add(new PongFrame("hello, ").setFin(false)); + send.add(new PongFrame().setPayload("hello, ").setFin(false)); send.add(new ContinuationFrame("world")); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -424,20 +424,20 @@ public class TestABCase5 extends AbstractABCase List send1 = new ArrayList<>(); send1.add(new TextFrame("f1").setFin(false)); send1.add(new ContinuationFrame(",f2").setFin(false)); - send1.add(new PingFrame("pong-1")); + send1.add(new PingFrame().setPayload("pong-1")); List send2 = new ArrayList<>(); send2.add(new ContinuationFrame(",f3").setFin(false)); send2.add(new ContinuationFrame(",f4").setFin(false)); - send2.add(new PingFrame("pong-2")); + send2.add(new PingFrame().setPayload("pong-2")); send2.add(new ContinuationFrame(",f5").setFin(true)); send2.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect1 = new ArrayList<>(); - expect1.add(new PongFrame("pong-1")); + expect1.add(new PongFrame().setPayload("pong-1")); List expect2 = new ArrayList<>(); - expect2.add(new PongFrame("pong-2")); + expect2.add(new PongFrame().setPayload("pong-2")); expect2.add(new TextFrame().setPayload("f1,f2,f3,f4,f5")); expect2.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -470,20 +470,20 @@ public class TestABCase5 extends AbstractABCase List send1 = new ArrayList<>(); send1.add(new TextFrame("f1").setFin(false)); send1.add(new ContinuationFrame(",f2").setFin(false)); - send1.add(new PingFrame("pong-1")); + send1.add(new PingFrame().setPayload("pong-1")); List send2 = new ArrayList<>(); send2.add(new ContinuationFrame(",f3").setFin(false)); send2.add(new ContinuationFrame(",f4").setFin(false)); - send2.add(new PingFrame("pong-2")); + send2.add(new PingFrame().setPayload("pong-2")); send2.add(new ContinuationFrame(",f5").setFin(true)); send2.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect1 = new ArrayList<>(); - expect1.add(new PongFrame("pong-1")); + expect1.add(new PongFrame().setPayload("pong-1")); List expect2 = new ArrayList<>(); - expect2.add(new PongFrame("pong-2")); + expect2.add(new PongFrame().setPayload("pong-2")); expect2.add(new TextFrame().setPayload("f1,f2,f3,f4,f5")); expect2.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -604,12 +604,12 @@ public class TestABCase5 extends AbstractABCase { List send = new ArrayList<>(); send.add(new TextFrame("hello, ").setFin(false)); - send.add(new PingFrame("ping")); + send.add(new PingFrame().setPayload("ping")); send.add(new ContinuationFrame("world").setFin(true)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame("ping")); + expect.add(new PongFrame().setPayload("ping")); expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -635,12 +635,12 @@ public class TestABCase5 extends AbstractABCase { List send = new ArrayList<>(); send.add(new TextFrame("hello, ").setFin(false)); - send.add(new PingFrame("ping")); + send.add(new PingFrame().setPayload("ping")); send.add(new ContinuationFrame("world").setFin(true)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame("ping")); + expect.add(new PongFrame().setPayload("ping")); expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -666,12 +666,12 @@ public class TestABCase5 extends AbstractABCase { List send = new ArrayList<>(); send.add(new TextFrame("hello, ").setFin(false)); - send.add(new PingFrame("ping")); + send.add(new PingFrame().setPayload("ping")); send.add(new ContinuationFrame("world").setFin(true)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); List expect = new ArrayList<>(); - expect.add(new PongFrame("ping")); + expect.add(new PongFrame().setPayload("ping")); expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java index 584a33b53f2..4b4c9d27bce 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java @@ -112,7 +112,7 @@ public class TestABCase7 extends AbstractABCase { List send = new ArrayList<>(); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - send.add(new PingFrame("out of band ping")); + send.add(new PingFrame().setPayload("out of band ping")); List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -202,7 +202,7 @@ public class TestABCase7 extends AbstractABCase List send = new ArrayList<>(); send.add(new TextFrame().setPayload(buf)); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - send.add(new PingFrame("out of band")); + send.add(new PingFrame().setPayload("out of band")); List expect = new ArrayList<>(); expect.add(new TextFrame().setPayload(clone(buf)));