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);
}
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);
}
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);
}
Aggregations