Search in sources :

Example 1 with Tester

use of org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester in project jetty.project by eclipse.

the class DeflateFrameExtensionTest method testChrome20_Info.

@Test
public void testChrome20_Info() {
    Tester tester = serverExtensions.newTester("deflate-frame");
    tester.assertNegotiated("deflate-frame");
    // Captured from Chrome 20.x - "info:" (sent from browser)
    tester.parseIncomingHex(// example payload 
    "c187ca4def7f0081a4b47d4fef");
    tester.assertHasFrames("info:");
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) AbstractExtensionTest(org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest) Test(org.junit.Test)

Example 2 with Tester

use of org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester in project jetty.project by eclipse.

the class DeflateFrameExtensionTest method testChrome20_HelloThere.

@Test
public void testChrome20_HelloThere() {
    Tester tester = serverExtensions.newTester("deflate-frame");
    tester.assertNegotiated("deflate-frame");
    // Captured from Chrome 20.x - "Hello" then "There" (sent from browser)
    tester.parseIncomingHex(// "Hello"
    "c1877b1971db8951bc12b21e71", // There
    "c18759edc8f4532480d913e8c8");
    tester.assertHasFrames("Hello", "There");
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) AbstractExtensionTest(org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest) Test(org.junit.Test)

Example 3 with Tester

use of org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester in project jetty.project by eclipse.

the class DeflateFrameExtensionTest method testPyWebSocket_TimeTimeTime.

@Test
public void testPyWebSocket_TimeTimeTime() {
    Tester tester = serverExtensions.newTester("deflate-frame");
    tester.assertNegotiated("deflate-frame");
    // Captured from Pywebsocket (r781) - "time:" sent 3 times.
    tester.parseIncomingHex(// "time:"
    "c1876b100104" + "41d9cd49de1201", // "time:"
    "c1852ae3ff01" + "00e2ee012a", // "time:"
    "c18435558caa" + "37468caa");
    tester.assertHasFrames("time:", "time:", "time:");
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) AbstractExtensionTest(org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest) Test(org.junit.Test)

Example 4 with Tester

use of org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester in project jetty.project by eclipse.

the class DeflateFrameExtensionTest method testBlockheadClient_HelloThere.

@Test
public void testBlockheadClient_HelloThere() {
    Tester tester = serverExtensions.newTester("deflate-frame");
    tester.assertNegotiated("deflate-frame");
    // Captured from Blockhead Client - "Hello" then "There" via unit test
    tester.parseIncomingHex(// "Hello"
    "c18700000000f248cdc9c90700", // "There"
    "c187000000000ac9482d4a0500");
    tester.assertHasFrames("Hello", "There");
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) AbstractExtensionTest(org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest) Test(org.junit.Test)

Example 5 with Tester

use of org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester in project jetty.project by eclipse.

the class PerMessageDeflateExtensionTest method testDraft21_Hello_UnCompressedBlock_Fragmented.

/**
     * Decode payload example as seen in draft-ietf-hybi-permessage-compression-21.
     * <p>
     * Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block (with fragmentation)
     */
@Test
public void testDraft21_Hello_UnCompressedBlock_Fragmented() {
    Tester tester = clientExtensions.newTester("permessage-deflate");
    tester.assertNegotiated("permessage-deflate");
    // basic, 1 block, compressed with 0 compression level (aka, uncompressed).
    tester.parseIncomingHex(// Fragment 1
    "0x41 0x03 0xf2 0x48 0xcd", // Fragment 2
    "0x80 0x04 0xc9 0xc9 0x07 0x00");
    tester.assertHasFrames(new TextFrame().setPayload("He").setFin(false), new ContinuationFrame().setPayload("llo").setFin(true));
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) TextFrame(org.eclipse.jetty.websocket.common.frames.TextFrame) ContinuationFrame(org.eclipse.jetty.websocket.common.frames.ContinuationFrame) AbstractExtensionTest(org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest) Test(org.junit.Test)

Aggregations

AbstractExtensionTest (org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest)17 Tester (org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester)17 Test (org.junit.Test)17 ContinuationFrame (org.eclipse.jetty.websocket.common.frames.ContinuationFrame)1 TextFrame (org.eclipse.jetty.websocket.common.frames.TextFrame)1