protected function setGuzzleProxyHandler(ContainerBuilder $container, $clientId, array $config)
    {
        // arguments (3 and 50) in handler factories below represents the maximum number of idle handles.
        // the values are the default defined in guzzle CurlHanddler and CurlMultiHandler
        $handlerFactorySync = new Definition('%m6web_guzlehttp.handler.curlfactory.class%');
        $handlerFactorySync->setPublic(true);
        $handlerFactorySync->setArguments([3]);

        $handlerFactoryNormal = new Definition('%m6web_guzlehttp.handler.curlfactory.class%');
        $handlerFactoryNormal->setPublic(true);
        $handlerFactoryNormal->setArguments([50]);

        $curlHandler = new Definition('%m6web_guzlehttp.handler.curlhandler.class%');
        $curlHandler->setPublic(true);
        $curlHandler->setArguments([new Reference('event_dispatcher'), ['handle_factory' => $handlerFactorySync] ]);
        $curlHandler->addMethodCall('setDebug', [$container->getParameter('kernel.debug')]);

        $curlMultiHandler = new Definition('%m6web_guzlehttp.handler.curlmultihandler.class%');
        $curlMultiHandler->setPublic(true);
        $curlMultiHandler->setArguments([new Reference('event_dispatcher'), ['handle_factory' => $handlerFactoryNormal] ]);
        $curlMultiHandler->addMethodCall('setDebug', [$container->getParameter('kernel.debug')]);

        if (array_key_exists('guzzlehttp_cache', $config)) {
            if (is_null($cacheService = $this->getServiceReference($container, $config['guzzlehttp_cache']['service']))) {
                throw new \InvalidArgumentException(sprintf(
                    '"guzzlehttp_cache.service" requires a valid service reference, "%s" given',
                    $config['guzzlehttp_cache']['service']
                ));
            }

            $defaultTtl = $config['guzzlehttp_cache']['default_ttl'];
            $headerTtl = $config['guzzlehttp_cache']['use_header_ttl'];
            $cacheServerErrors = $config['guzzlehttp_cache']['cache_server_errors'];
            $cacheClientErrors = $config['guzzlehttp_cache']['cache_client_errors'];
            $ignoreCacheErrors = $config['guzzlehttp_cache']['ignore_cache_errors'];

            $curlHandler->addMethodCall('setCache', [$cacheService, $defaultTtl, $headerTtl, $cacheServerErrors, $cacheClientErrors, $ignoreCacheErrors]);
            $curlMultiHandler->addMethodCall('setCache', [$cacheService, $defaultTtl, $headerTtl, $cacheServerErrors, $cacheClientErrors, $ignoreCacheErrors]);
        }

        $proxyHandler = new Definition('%m6web_guzzlehttp.guzzle.proxyhandler.class%');
        $proxyHandler->setPublic(true);
        $proxyHandler->setFactory(['%m6web_guzzlehttp.guzzle.proxyhandler.class%', 'wrapSync']);
        $proxyHandler->setArguments([$curlMultiHandler, $curlHandler]);

        $container->setDefinition('m6web_guzzlehttp.guzzle.proxyhandler_'.$clientId, $proxyHandler);
    }