Search in sources :

Example 16 with Tester

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

the class PerMessageDeflateExtensionTest method testDraft21_DeflateBlockWithNoCompression.

/**
     * Decode payload example as seen in draft-ietf-hybi-permessage-compression-21.
     * <p>
     * Section 8.2.3.3: Using a DEFLATE Block with No Compression
     */
@Test
public void testDraft21_DeflateBlockWithNoCompression() {
    Tester tester = clientExtensions.newTester("permessage-deflate");
    tester.assertNegotiated("permessage-deflate");
    // 1 message / no compression
    tester.parseIncomingHex(// example frame
    "0xc1 0x0b 0x00 0x05 0x00 0xfa 0xff 0x48 0x65 0x6c 0x6c 0x6f 0x00");
    tester.assertHasFrames("Hello");
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) AbstractExtensionTest(org.eclipse.jetty.websocket.common.extensions.AbstractExtensionTest) Test(org.junit.Test)

Example 17 with Tester

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

the class PerMessageDeflateExtensionTest method testPyWebSocket_Client_NoContextTakeover_ThreeOra.

@Test
public void testPyWebSocket_Client_NoContextTakeover_ThreeOra() {
    Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover");
    tester.assertNegotiated("permessage-deflate");
    // Captured from Pywebsocket (r790) - 3 messages with similar parts.
    // context takeover (3 messages)
    tester.parseIncomingHex(// ToraTora
    "c1 09 0a c9 2f 4a 0c 01  62 00 00", // AtoraFlora
    "c1 0b 72 2c c9 2f 4a 74  cb 01 12 00 00", // PhloraTora
    "c1 0b 0a c8 c8 c9 2f 4a  0c 01 62 00 00");
    tester.assertHasFrames("ToraTora", "AtoraFlora", "PhloraTora");
}
Also used : Tester(org.eclipse.jetty.websocket.common.extensions.ExtensionTool.Tester) 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