class PerMessageDeflateExtension extends CompressExtension {

    @Override
    public void setConfig(final ExtensionConfig config) {
        configRequested = new ExtensionConfig(config);
        configNegotiated = new ExtensionConfig(config.getName());

        for (String key : config.getParameterKeys()) {
            key = key.trim();
            switch (key) {
                case "client_max_window_bits":
                case "server_max_window_bits": {
                    // Don't negotiate these parameters
                    break;
                }
                case "client_no_context_takeover": {
                    configNegotiated.setParameter("client_no_context_takeover");
                    switch (getPolicy().getBehavior()) {
                        case CLIENT:
                            incomingContextTakeover = false;
                            break;
                        case SERVER:
                            outgoingContextTakeover = false;
                            break;
                    }
                    break;
                }
                case "server_no_context_takeover": {
                    configNegotiated.setParameter("server_no_context_takeover");
                    switch (getPolicy().getBehavior()) {
                        case CLIENT:
                            outgoingContextTakeover = false;
                            break;
                        case SERVER:
                            incomingContextTakeover = false;
                            break;
                    }
                    break;
                }
                default: {
                    throw new IllegalArgumentException();
                }
            }
        }

        LOG.debug("config: outgoingContextTakeover={}, incomingContextTakeover={} : {}", outgoingContextTakeover, incomingContextTakeover, this);

        super.setConfig(configNegotiated);
    }

}