protected ClientCache createClientCache(final boolean durable) {
    String gemfireClientName =
        DurableClientCacheIntegrationTest.class.getSimpleName().concat("Client");

    ClientCacheFactory clientCacheFactory =
        new ClientCacheFactory()
            .addPoolServer(SERVER_HOST, SERVER_PORT)
            .setPoolSubscriptionEnabled(true)
            .set("name", gemfireClientName)
            .set("mcast-port", "0")
            .set("log-level", "config");

    if (durable) {
      clientCacheFactory.set("durable-client-id", gemfireClientName.concat("Id"));
      clientCacheFactory.set("durable-client-timeout", "300");
    }

    ClientCache clientCache = clientCacheFactory.create();

    assertThat(clientCache, is(notNullValue()));

    ClientRegionFactory<String, Integer> clientRegionFactory =
        clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);

    clientRegionFactory.setKeyConstraint(String.class);
    clientRegionFactory.setValueConstraint(Integer.class);

    if (durable) {
      clientRegionFactory.addCacheListener(
          new CacheListenerAdapter<String, Integer>() {
            @Override
            public void afterCreate(final EntryEvent<String, Integer> event) {
              System.out.printf(
                  "Created new entry in Region (%1$s) with key (%2$s) and value (%3$s)%n",
                  event.getRegion().getFullPath(), event.getKey(), event.getNewValue());
              regionCacheListenerEventValues.add(event.getNewValue());
            }

            @Override
            public void afterRegionLive(final RegionEvent<String, Integer> event) {
              System.out.printf("Region (%1$s) is live!%n", event.getRegion().getName());
            }
          });
    }

    Region<String, Integer> example = clientRegionFactory.create("Example");

    assertRegion(example, "Example", DataPolicy.NORMAL);

    return clientCache;
  }
  @Override
  protected Region<K, V> lookupFallback(GemFireCache cache, String regionName) throws Exception {
    Assert.isTrue(cache instanceof ClientCache, "Unable to create regions from " + cache);

    ClientCache c = (ClientCache) cache;

    // first look at shortcut
    ClientRegionShortcut s = null;

    if (shortcut == null) {
      if (dataPolicy != null) {
        if (DataPolicy.EMPTY.equals(dataPolicy)) {
          s = ClientRegionShortcut.PROXY;
        } else if (DataPolicy.PERSISTENT_REPLICATE.equals(dataPolicy)) {
          s = ClientRegionShortcut.LOCAL_PERSISTENT;
        }
      }
      s = ClientRegionShortcut.LOCAL;
    } else {
      s = shortcut;
    }

    ClientRegionFactory<K, V> factory = c.createClientRegionFactory(s);

    // map the attributes onto the client
    if (attributes != null) {
      CacheListener<K, V>[] listeners = attributes.getCacheListeners();
      if (!ObjectUtils.isEmpty(listeners)) {
        for (CacheListener<K, V> listener : listeners) {
          factory.addCacheListener(listener);
        }
      }
      factory.setCloningEnabled(attributes.getCloningEnabled());
      factory.setConcurrencyLevel(attributes.getConcurrencyLevel());
      factory.setCustomEntryIdleTimeout(attributes.getCustomEntryIdleTimeout());
      factory.setCustomEntryTimeToLive(attributes.getCustomEntryTimeToLive());
      factory.setDiskStoreName(attributes.getDiskStoreName());
      factory.setDiskSynchronous(attributes.isDiskSynchronous());
      factory.setEntryIdleTimeout(attributes.getEntryIdleTimeout());
      factory.setEntryTimeToLive(attributes.getEntryTimeToLive());
      factory.setEvictionAttributes(attributes.getEvictionAttributes());
      factory.setInitialCapacity(attributes.getInitialCapacity());
      factory.setKeyConstraint(attributes.getKeyConstraint());
      factory.setLoadFactor(attributes.getLoadFactor());
      factory.setPoolName(attributes.getPoolName());
      factory.setRegionIdleTimeout(attributes.getRegionIdleTimeout());
      factory.setRegionTimeToLive(attributes.getRegionTimeToLive());
      factory.setStatisticsEnabled(attributes.getStatisticsEnabled());
      factory.setValueConstraint(attributes.getValueConstraint());
    }

    if (!ObjectUtils.isEmpty(cacheListeners)) {
      for (CacheListener<K, V> listener : cacheListeners) {
        factory.addCacheListener(listener);
      }
    }

    if (StringUtils.hasText(poolName)) {
      // try to eagerly initialize the pool name, if defined as a bean
      if (beanFactory.isTypeMatch(poolName, Pool.class)) {
        if (log.isDebugEnabled()) {
          log.debug(
              "Found bean definition for pool '" + poolName + "'. Eagerly initializing it...");
        }
        beanFactory.getBean(poolName, Pool.class);
      }

      factory.setPoolName(poolName);
    }

    Region<K, V> reg = factory.create(regionName);
    log.info("Created new cache region [" + regionName + "]");
    if (snapshot != null) {
      reg.loadSnapshot(snapshot.getInputStream());
    }

    return reg;
  }