public void SetUp()
        {
            _client1 = MockRepository.GenerateStub<IMembaseManagementClient>();
            _client2 = MockRepository.GenerateStub<IMembaseManagementClient>();

            _clientPool = new ManagementClientPool(new[] { _client1, _client2 });
            _pooledClient = new PooledManagementClient(_clientPool);
        }
        /// <summary>
        /// This should be called when a client call failed with a connection exception.
        /// This will then go to the next available client in the client list for 
        /// GetCurrentClient().
        /// </summary>
        /// <param name="failedClient">The client instance that failed.</param>
        public void HandleClientFailure(IMembaseManagementClient failedClient)
        {
            if (failedClient == null)
                throw new ArgumentNullException("failedClient");

            lock (ClientLock)
            {
                // see if another thread already handled this client's failure
                var currentContainer = GetCurrentClientContainer();
                if (failedClient != currentContainer.Client)
                {
                    return;
                }

                // record that this client failed
                currentContainer.FailureCount++;

                // go to the next client in the list
                IncrementCurrentClientIndex();
            }
        }
 public ClientContainer(IMembaseManagementClient client)
 {
     Client = client;
 }