Search in sources :

Example 1 with DeflateFrameServerExtensionHandshaker

use of io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker in project netty by netty.

the class DeflateFrameServerExtensionHandshakerTest method testNormalHandshake.

@Test
public void testNormalHandshake() {
    // initialize
    DeflateFrameServerExtensionHandshaker handshaker = new DeflateFrameServerExtensionHandshaker();
    // execute
    WebSocketServerExtension extension = handshaker.handshakeExtension(new WebSocketExtensionData(DEFLATE_FRAME_EXTENSION, Collections.<String, String>emptyMap()));
    // test
    assertNotNull(extension);
    assertEquals(WebSocketServerExtension.RSV1, extension.rsv());
    assertTrue(extension.newExtensionDecoder() instanceof PerFrameDeflateDecoder);
    assertTrue(extension.newExtensionEncoder() instanceof PerFrameDeflateEncoder);
}
Also used : WebSocketServerExtension(io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension) DeflateFrameServerExtensionHandshaker(io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker) WebSocketExtensionData(io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionData) Test(org.junit.Test)

Example 2 with DeflateFrameServerExtensionHandshaker

use of io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker in project netty by netty.

the class DeflateFrameServerExtensionHandshakerTest method testWebkitHandshake.

@Test
public void testWebkitHandshake() {
    // initialize
    DeflateFrameServerExtensionHandshaker handshaker = new DeflateFrameServerExtensionHandshaker();
    // execute
    WebSocketServerExtension extension = handshaker.handshakeExtension(new WebSocketExtensionData(X_WEBKIT_DEFLATE_FRAME_EXTENSION, Collections.<String, String>emptyMap()));
    // test
    assertNotNull(extension);
    assertEquals(WebSocketServerExtension.RSV1, extension.rsv());
    assertTrue(extension.newExtensionDecoder() instanceof PerFrameDeflateDecoder);
    assertTrue(extension.newExtensionEncoder() instanceof PerFrameDeflateEncoder);
}
Also used : WebSocketServerExtension(io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension) DeflateFrameServerExtensionHandshaker(io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker) WebSocketExtensionData(io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionData) Test(org.junit.Test)

Example 3 with DeflateFrameServerExtensionHandshaker

use of io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker in project netty by netty.

the class DeflateFrameServerExtensionHandshakerTest method testFailedHandshake.

@Test
public void testFailedHandshake() {
    // initialize
    DeflateFrameServerExtensionHandshaker handshaker = new DeflateFrameServerExtensionHandshaker();
    Map<String, String> parameters;
    parameters = new HashMap<String, String>();
    parameters.put("unknown", "11");
    // execute
    WebSocketServerExtension extension = handshaker.handshakeExtension(new WebSocketExtensionData(DEFLATE_FRAME_EXTENSION, parameters));
    // test
    assertNull(extension);
}
Also used : WebSocketServerExtension(io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension) DeflateFrameServerExtensionHandshaker(io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker) WebSocketExtensionData(io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionData) Test(org.junit.Test)

Aggregations

WebSocketExtensionData (io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionData)3 WebSocketServerExtension (io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension)3 DeflateFrameServerExtensionHandshaker (io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameServerExtensionHandshaker)3 Test (org.junit.Test)3