Examples of PingFrame


Examples of org.eclipse.jetty.websocket.common.frames.PingFrame


    @Test
    public void testGenerateEmptyPingCase2_1()
    {
        WebSocketFrame pingFrame = new PingFrame();

        ByteBuffer actual = UnitGenerator.generate(pingFrame);

        ByteBuffer expected = ByteBuffer.allocate(5);
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

    public void testGenerateHelloPingCase2_2()
    {
        String message = "Hello, world!";
        byte[] messageBytes = StringUtil.getUtf8Bytes(message);

        PingFrame pingFrame = new PingFrame().setPayload(messageBytes);

        ByteBuffer actual = UnitGenerator.generate(pingFrame);

        ByteBuffer expected = ByteBuffer.allocate(32);
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

    public void testGenerateOversizedBinaryPingCase2_5_A()
    {
        byte[] bytes = new byte[126];
        Arrays.fill(bytes,(byte)0x00);

        PingFrame pingFrame = new PingFrame();
        pingFrame.setPayload(ByteBuffer.wrap(bytes)); // should throw exception
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

    public void testGenerateOversizedBinaryPingCase2_5_B()
    {
        byte[] bytes = new byte[126];
        Arrays.fill(bytes, (byte)0x00);

        PingFrame pingFrame = new PingFrame();
        pingFrame.setPayload(ByteBuffer.wrap(bytes)); // should throw exception

        // FIXME: Remove? UnitGenerator.generate(pingFrame);
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

    }

    @Test
    public void testSingleUnmaskedPingRequest() throws Exception
    {
        PingFrame ping = new PingFrame().setPayload("Hello");

        ByteBuffer actual = UnitGenerator.generate(ping);

        ByteBuffer expected = ByteBuffer.allocate(10);
        expected.put(new byte[]
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

    public static Collection<WebSocketFrame[]> data()
    {
        List<WebSocketFrame[]> data = new ArrayList<>();
        // @formatter:off
        data.add(new WebSocketFrame[]
                { new PingFrame().setFin(false) });
        data.add(new WebSocketFrame[]
                { new PingFrame().setRsv1(true) });
        data.add(new WebSocketFrame[]
                { new PingFrame().setRsv2(true) });
        data.add(new WebSocketFrame[]
                { new PingFrame().setRsv3(true) });
        data.add(new WebSocketFrame[]
                { new PongFrame().setFin(false) });
        data.add(new WebSocketFrame[]
                { new PingFrame().setRsv1(true) });
        data.add(new WebSocketFrame[]
                { new PongFrame().setRsv2(true) });
        data.add(new WebSocketFrame[]
                { new PongFrame().setRsv3(true) });
        data.add(new WebSocketFrame[]
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

        // Wire up stack
        ext.setNextIncomingFrames(capture);

        String payload = "Are you there?";
        Frame ping = new PingFrame().setPayload(payload);
        ext.incomingFrame(ping);

        capture.assertFrameCount(1);
        capture.assertHasFrame(OpCode.PING, 1);
        WebSocketFrame actual = capture.getFrames().poll();
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

        // Wire up stack
        ext.setNextOutgoingFrames(capture);

        String payload = "Are you there?";
        Frame ping = new PingFrame().setPayload(payload);

        ext.outgoingFrame(ping, null, BatchMode.OFF);

        capture.assertFrameCount(1);
        capture.assertHasFrame(OpCode.PING, 1);
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

        // Prepare frames
        WebSocketFrame[] frames = new WebSocketFrame[pingCount + 1];
        for (int i = 0; i < pingCount; i++)
        {
            frames[i] = new PingFrame().setPayload(String.format("ping-%d",i));
        }
        frames[pingCount] = new CloseInfo(StatusCode.NORMAL).asFrame();

        // Mask All Frames
        byte maskingKey[] = Hex.asByteArray("11223344");
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.frames.PingFrame

    public void testCase4_1_3() throws Exception
    {
        List<WebSocketFrame> send = new ArrayList<>();
        send.add(new TextFrame().setPayload("hello"));
        send.add(new BadFrame((byte)5)); // intentionally bad
        send.add(new PingFrame());

        List<WebSocketFrame> expect = new ArrayList<>();
        expect.add(new TextFrame().setPayload("hello")); // echo
        expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.