PerMessageDeflateClientExtensionHandshaker implements WebSocketClientExtensionHandshaker { @Override public WebSocketExtensionData newRequestData() { HashMap<String, String> parameters = new HashMap<String, String>(4); if (requestedServerWindowSize != MAX_WINDOW_SIZE) { parameters.put(SERVER_NO_CONTEXT, null); } if (allowClientNoContext) { parameters.put(CLIENT_NO_CONTEXT, null); } if (requestedServerWindowSize != MAX_WINDOW_SIZE) { parameters.put(SERVER_MAX_WINDOW, Integer.toString(requestedServerWindowSize)); } if (allowClientWindowSize) { parameters.put(CLIENT_MAX_WINDOW, null); } return new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, parameters); } PerMessageDeflateClientExtensionHandshaker();  PerMessageDeflateClientExtensionHandshaker(int compressionLevel,
            boolean allowClientWindowSize, int requestedServerWindowSize,
            boolean allowClientNoContext, boolean requestedServerNoContext); @Override WebSocketExtensionData newRequestData(); @Override WebSocketClientExtension handshakeExtension(WebSocketExtensionData extensionData);  }
@Test public void testCustomData() { PerMessageDeflateClientExtensionHandshaker handshaker = new PerMessageDeflateClientExtensionHandshaker(6, true, 10, true, true); WebSocketExtensionData data = handshaker.newRequestData(); assertEquals(PERMESSAGE_DEFLATE_EXTENSION, data.name()); assertTrue(data.parameters().containsKey(CLIENT_MAX_WINDOW)); assertTrue(data.parameters().containsKey(SERVER_MAX_WINDOW)); assertEquals("10", data.parameters().get(SERVER_MAX_WINDOW)); assertTrue(data.parameters().containsKey(CLIENT_MAX_WINDOW)); assertTrue(data.parameters().containsKey(SERVER_MAX_WINDOW)); }