public void Test()
        {
            Assert.That(HDns.GetHostName(), Is.EqualTo(Dns.GetHostName()));

            Assert.That(AreEqual(HDns.GetHostEntry("127.0.0.1"), Dns.GetHostEntry("127.0.0.1")), Is.True);
            Assert.That(AreEqual(HDns.GetHostEntry("www.hazelcast.com"), Dns.GetHostEntry("www.hazelcast.com")), Is.True);

            Assert.That(AreEqual(HDns.GetHostEntry(IPAddress.Parse("127.0.0.1")), Dns.GetHostEntry(IPAddress.Parse("127.0.0.1"))), Is.True);

            Assert.That(AreEqual(HDns.GetHostAddresses("127.0.0.1"), Dns.GetHostAddresses("127.0.0.1")), Is.True);
            Assert.That(AreEqual(HDns.GetHostAddresses("www.hazelcast.com"), Dns.GetHostAddresses("www.hazelcast.com")), Is.True);
        }
        public async Task SingleFailureAtAddressResolutionShouldNotBlowUpClient()
        {
            using var altDns = HDns.Override(new AltDns(2));

            await using var client = await CreateAndStartClientAsync();

            await Task.Delay(1000);

            // client is still active and connected
            Assert.That(client.IsActive);
            Assert.That(client.IsConnected);
        }
        public async Task SingleFailureAtAddressResolutionShouldNotBlowUpClient()
        {
            using var _ = HConsoleForTest();

            using var altDns = HDns.Override(new AltDns(2));

            await using var client = await CreateAndStartClientAsync();

            await AssertEx.SucceedsEventually(() =>
            {
                // client is active and connected
                Assert.That(client.IsActive);
                Assert.That(client.IsConnected);
            }, 4000, 500);

            await Task.Delay(1000);

            // client is still active and connected
            Assert.That(client.IsActive);
            Assert.That(client.IsConnected);
        }
        public async Task SingleFailureAtAddressResolutionShouldNotBlowUpClient()
        {
            using var _ = HConsoleForTest();
            HConsole.WriteLine(this, "Begin");

            // the alt DNS will throw on the Nth invocation of GetHostAddresses
            // the original test threw at '2' and that was when getting an address to connect to
            // the original code & test was not resilient to failures in other places, either
            //
            // 1: getting an address to connect to
            // 2: decoding the auth response (fatal)
            // 3: decoding the members view event (fatal)
            // ...
            var altDns = new AltDns(1);

            using var dnsOverride = HDns.Override(altDns);

            await using var client = await CreateAndStartClientAsync(options =>
            {
                // make sure to use a hostname, not 127.0.0.1, to use the DNS
                options.Networking.Addresses.Clear();
                options.Networking.Addresses.Add("localhost:5701");
            });

            await AssertEx.SucceedsEventually(() =>
            {
                // client is active and connected
                Assert.That(client.IsActive);
                Assert.That(client.IsConnected);
            }, 4000, 500);

            await Task.Delay(1000);

            // dns has been used
            Assert.That(altDns.Count, Is.GreaterThan(0));

            // client is still active and connected
            Assert.That(client.IsActive);
            Assert.That(client.IsConnected);
        }