/**
         * <summary>
         * This method will create a client with default configuration. Note that this method expects that
         * first node will bind rest binary protocol on default port. It also expects that partitioned cache is
         * configured in grid.</summary>
         *
         * <param name="passcode">Passcode.</param>
         * <returns>Client instance.</returns>
         * <exception cref="GridClientException">If client could not be created.</exception>
         */
        private static IGridClient CreateClient(String passcode)
        {
            var partitioned = new GridClientDataConfiguration();

            // Set remote cache name.
            partitioned.Name = "partitioned";

            // Set client partitioned affinity for this cache.
            partitioned.Affinity = new GridClientPartitionedAffinity();

            var cc = new GridClientConfiguration();

            cc.DataConfigurations.Add(partitioned);

            // Point client to a local node.
            cc.Servers.Add(ServerAddress + ":" + GridClientConfiguration.DefaultTcpPort);

            // Set passcode credentials.
            cc.Credentials = passcode;

            // If we use ssl, set appropriate key- and trust-store.
            if (UseSsl) {
                var sslCtx = new GridClientSslContext();

                sslCtx.ClientCertificates.Add(new X509Certificate2("cert\\client.pfx", "123456"));

                cc.SslContext = sslCtx;
            }

            return GridClientFactory.Start(cc);
        }
        /**
         * <summary>
         * This method will create a client with default configuration. Note that this method expects that
         * first node will bind rest binary protocol on default port. It also expects that partitioned cache is
         * configured in grid.</summary>
         *
         * <returns>Client instance.</returns>
         * <exception cref="GridClientException">If client could not be created.</exception>
         */
        private static IGridClient CreateClient()
        {
            var cacheCfg = new GridClientDataConfiguration();

            // Set remote cache name.
            cacheCfg.Name = "partitioned";

            // Set client partitioned affinity for this cache.
            cacheCfg.Affinity = new GridClientPartitionAffinity();

            var cfg = new GridClientConfiguration();

            cfg.DataConfigurations.Add(cacheCfg);

            // Point client to a local node. Note that this server is only used
            // for initial connection. After having established initial connection
            // client will make decisions which grid node to use based on collocation
            // with key affinity or load balancing.
            cfg.Servers.Add(ServerAddress + ':' + GridClientConfiguration.DefaultTcpPort);

            return(GridClientFactory.Start(cfg));
        }