private LazyConnectExchangeClient ReplaceWithLazyClient()
        {
            URL lazyUrl = Url.AddParameter(Constants.LazyConnectInitialStateKey, false)
                          .AddParameter(Constants.ReconnectKey, false)
                          .AddParameter(Constants.SendReconnectKey, true)
                          .AddParameter("warning", true)
                          .AddParameter(LazyConnectExchangeClient.RequestWithWarningKey, true)
                          .AddParameter("_client_memo", "referencecounthandler.replacewithlazyclient");

            var key = Url.GetAddress();
            // in worst case there's only one ghost connection.
            LazyConnectExchangeClient gclient = null;

            if (_ghostClientMap.ContainsKey(key))
            {
                _ghostClientMap.TryGetValue(key, out gclient);
            }
            if (gclient == null || gclient.IsClosed)
            {
                gclient = new LazyConnectExchangeClient(lazyUrl, _client.GetExchangeHandler());
                _ghostClientMap.TryAdd(key, gclient);
            }
            return(gclient);
        }