// The bulk of the clean-up code is implemented in Dispose(bool)
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }
            if (_client == null)
            {
                return;
            }

            _client.Dispose();
            _client = null;
        }
        /// <summary>
        /// Disposes the object in a safe way.
        /// Used internally! Do not use directly!
        /// </summary>
        /// <param name="disposing">Is disposing?</param>
        protected virtual void Dispose(bool disposing)
        {
            lock (_lock)
            {
                if (_disposed)
                {
                    return;
                }
                if (!disposing)
                {
                    return;
                }
                if (_client == null)
                {
                    return;
                }

                _client.Dispose();
                _client   = null;
                _disposed = true;
            }
        }