예제 #1
0
        public void testBackgroundConnect()
        {
            int CONNECTION_TIMEOUT_MS = 4000;

            using (CuratorZookeeperClient client = new CuratorZookeeperClient(server.GetConnectionString(), 10000, CONNECTION_TIMEOUT_MS, null, new RetryOneTime(TimeSpan.FromSeconds(1))))
            {
                Assert.False(client.IsConnected());
                client.Start();

outer:
                do
                {
                    for (int i = 0; i < (CONNECTION_TIMEOUT_MS / 1000); ++i)
                    {
                        if (client.IsConnected())
                        {
                            goto outer;
                        }

                        Thread.Sleep(CONNECTION_TIMEOUT_MS);
                    }

                    Assert.Fail();
                } while (false);
            }
        }