/** @return Client configuration for the test. */
  protected GridClientConfiguration clientConfiguration() throws GridClientException {
    GridClientConfiguration cfg = new GridClientConfiguration();

    cfg.setBalancer(getBalancer());

    cfg.setTopologyRefreshFrequency(TOP_REFRESH_FREQ);

    cfg.setProtocol(protocol());
    cfg.setServers(Arrays.asList(serverAddress()));
    cfg.setSslContextFactory(sslContextFactory());

    GridClientDataConfiguration loc = new GridClientDataConfiguration();

    GridClientDataConfiguration partitioned = new GridClientDataConfiguration();

    partitioned.setName(PARTITIONED_CACHE_NAME);
    partitioned.setAffinity(new GridClientPartitionAffinity());

    GridClientDataConfiguration replicated = new GridClientDataConfiguration();
    replicated.setName(REPLICATED_CACHE_NAME);

    GridClientDataConfiguration replicatedAsync = new GridClientDataConfiguration();
    replicatedAsync.setName(REPLICATED_ASYNC_CACHE_NAME);

    cfg.setDataConfigurations(Arrays.asList(loc, partitioned, replicated, replicatedAsync));

    return cfg;
  }
  /**
   * Copy constructor.
   *
   * @param cfg Configuration to be copied.
   */
  public GridClientConfiguration(GridClientConfiguration cfg) {
    // Preserve alphabetical order for maintenance;
    autoFetchAttrs = cfg.isAutoFetchAttributes();
    autoFetchMetrics = cfg.isAutoFetchMetrics();
    balancer = cfg.getBalancer();
    connectTimeout = cfg.getConnectTimeout();
    credProvider = cfg.getSecurityCredentialsProvider();
    enableAttrsCache = cfg.isEnableAttributesCache();
    enableMetricsCache = cfg.isEnableMetricsCache();
    executor = cfg.getExecutorService();
    marshaller = cfg.getMarshaller();
    maxConnIdleTime = cfg.getMaxConnectionIdleTime();
    pingInterval = cfg.getPingInterval();
    pingTimeout = cfg.getPingTimeout();
    proto = cfg.getProtocol();
    routers = cfg.getRouters();
    srvs = cfg.getServers();
    sslCtxFactory = cfg.getSslContextFactory();
    tcpNoDelay = cfg.isTcpNoDelay();
    topRefreshFreq = cfg.getTopologyRefreshFrequency();
    daemon = cfg.isDaemon();
    marshaller = cfg.getMarshaller();

    setDataConfigurations(cfg.getDataConfigurations());
  }