/// <summary>
        /// Asserts client connection count.
        /// </summary>
        protected static void AssertClientConnectionCount(IIgniteClient client, int count)
        {
            var res = TestUtils.WaitForCondition(() =>
            {
                // Perform any operation to cause topology update.
                try
                {
                    client.GetCacheNames();
                }
                catch (Exception)
                {
                    // Ignore.
                }

                return(count == client.GetConnections().Count());
            }, 9000);

            if (!res)
            {
                Assert.Fail("Client connection count mismatch: expected {0}, but was {1}",
                            count, client.GetConnections().Count());
            }

            var cluster = Ignition.GetAll().First().GetCluster();

            foreach (var connection in client.GetConnections())
            {
                var server = cluster.GetNode(connection.NodeId);
                Assert.IsNotNull(server);

                var remoteEndPoint = (IPEndPoint)connection.RemoteEndPoint;
                Assert.AreEqual(server.GetAttribute <int>("clientListenerPort"), remoteEndPoint.Port);

                var ipAddresses = server.Addresses
                                  .Select(a => a.Split('%').First()) // Trim IPv6 scope.
                                  .Select(IPAddress.Parse)
                                  .ToArray();

                CollectionAssert.Contains(ipAddresses, remoteEndPoint.Address);

                var localEndPoint = (IPEndPoint)connection.LocalEndPoint;
                CollectionAssert.Contains(new[] { IPAddress.Loopback, IPAddress.IPv6Loopback }, localEndPoint.Address);
            }
        }