/// <exception cref="System.Exception"></exception>
        public virtual void TestFetchRemoteCheckpointDoc()
        {
            HttpClientFactory mockHttpClientFactory = new _HttpClientFactory_583();

            Log.D("TEST", "testFetchRemoteCheckpointDoc() called");
            string dbUrlString = "http://fake.test-url.com:4984/fake/";
            Uri    remote      = new Uri(dbUrlString);

            database.SetLastSequence("1", remote, true);
            // otherwise fetchRemoteCheckpoint won't contact remote
            Replication replicator = new Pusher(database, remote, false, mockHttpClientFactory
                                                , manager.GetWorkExecutor());
            CountDownLatch doneSignal = new CountDownLatch(1);

            ReplicationTest.ReplicationObserver replicationObserver = new ReplicationTest.ReplicationObserver
                                                                          (this, doneSignal);
            replicator.AddChangeListener(replicationObserver);
            replicator.FetchRemoteCheckpointDoc();
            Log.D(Tag, "testFetchRemoteCheckpointDoc() Waiting for replicator to finish");
            try
            {
                bool succeeded = doneSignal.Await(300, TimeUnit.Seconds);
                NUnit.Framework.Assert.IsTrue(succeeded);
                Log.D(Tag, "testFetchRemoteCheckpointDoc() replicator finished");
            }
            catch (Exception e)
            {
                Sharpen.Runtime.PrintStackTrace(e);
            }
            string errorMessage = "Since we are passing in a mock http client that always throws "
                                  + "errors, we expect the replicator to be in an error state";

            NUnit.Framework.Assert.IsNotNull(errorMessage, replicator.GetLastError());
        }
        private void RunReplication(Replication replication)
        {
            CountDownLatch replicationDoneSignal = new CountDownLatch(1);

            ReplicationTest.ReplicationObserver replicationObserver = new ReplicationTest.ReplicationObserver
                                                                          (this, replicationDoneSignal);
            replication.AddChangeListener(replicationObserver);
            replication.Start();
            CountDownLatch replicationDoneSignalPolling = ReplicationWatcherThread(replication
                                                                                   );

            Log.D(Tag, "Waiting for replicator to finish");
            try
            {
                bool success = replicationDoneSignal.Await(300, TimeUnit.Seconds);
                NUnit.Framework.Assert.IsTrue(success);
                success = replicationDoneSignalPolling.Await(300, TimeUnit.Seconds);
                NUnit.Framework.Assert.IsTrue(success);
                Log.D(Tag, "replicator finished");
            }
            catch (Exception e)
            {
                Sharpen.Runtime.PrintStackTrace(e);
            }
        }
		/// <exception cref="System.Exception"></exception>
		public virtual void TestFetchRemoteCheckpointDoc()
		{
			HttpClientFactory mockHttpClientFactory = new _HttpClientFactory_583();
			Log.D("TEST", "testFetchRemoteCheckpointDoc() called");
			string dbUrlString = "http://fake.test-url.com:4984/fake/";
			Uri remote = new Uri(dbUrlString);
			database.SetLastSequence("1", remote, true);
			// otherwise fetchRemoteCheckpoint won't contact remote
			Replication replicator = new Pusher(database, remote, false, mockHttpClientFactory
				, manager.GetWorkExecutor());
			CountDownLatch doneSignal = new CountDownLatch(1);
			ReplicationTest.ReplicationObserver replicationObserver = new ReplicationTest.ReplicationObserver
				(this, doneSignal);
			replicator.AddChangeListener(replicationObserver);
			replicator.FetchRemoteCheckpointDoc();
			Log.D(Tag, "testFetchRemoteCheckpointDoc() Waiting for replicator to finish");
			try
			{
				bool succeeded = doneSignal.Await(300, TimeUnit.Seconds);
				NUnit.Framework.Assert.IsTrue(succeeded);
				Log.D(Tag, "testFetchRemoteCheckpointDoc() replicator finished");
			}
			catch (Exception e)
			{
				Sharpen.Runtime.PrintStackTrace(e);
			}
			string errorMessage = "Since we are passing in a mock http client that always throws "
				 + "errors, we expect the replicator to be in an error state";
			NUnit.Framework.Assert.IsNotNull(errorMessage, replicator.GetLastError());
		}
		private void RunReplication(Replication replication)
		{
			CountDownLatch replicationDoneSignal = new CountDownLatch(1);
			ReplicationTest.ReplicationObserver replicationObserver = new ReplicationTest.ReplicationObserver
				(this, replicationDoneSignal);
			replication.AddChangeListener(replicationObserver);
			replication.Start();
			CountDownLatch replicationDoneSignalPolling = ReplicationWatcherThread(replication
				);
			Log.D(Tag, "Waiting for replicator to finish");
			try
			{
				bool success = replicationDoneSignal.Await(300, TimeUnit.Seconds);
				NUnit.Framework.Assert.IsTrue(success);
				success = replicationDoneSignalPolling.Await(300, TimeUnit.Seconds);
				NUnit.Framework.Assert.IsTrue(success);
				Log.D(Tag, "replicator finished");
			}
			catch (Exception e)
			{
				Sharpen.Runtime.PrintStackTrace(e);
			}
		}