@Override
  protected CacheStoreConfig createCacheStoreConfig() throws Exception {
    RemoteCacheStoreConfig remoteCacheStoreConfig = new RemoteCacheStoreConfig();
    localCacheManager = TestCacheManagerFactory.createLocalCacheManager(false);
    hrServer = TestHelper.startHotRodServer(localCacheManager);

    remoteCacheStoreConfig.setRemoteCacheName(CacheContainer.DEFAULT_CACHE_NAME);
    Properties properties = new Properties();
    properties.put("infinispan.client.hotrod.server_list", "localhost:" + hrServer.getPort());
    remoteCacheStoreConfig.setHotRodClientProperties(properties);

    return remoteCacheStoreConfig;
  }
  @BeforeClass
  public void setup() throws Exception {
    ConfigurationBuilder serverBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    serverBuilder
        .eviction()
        .maxEntries(100)
        .strategy(EvictionStrategy.UNORDERED)
        .expiration()
        .wakeUpInterval(10L);
    serverCacheManager = TestCacheManagerFactory.createCacheManager(serverBuilder);
    serverCache = serverCacheManager.getCache();
    sourceServer = TestHelper.startHotRodServer(serverCacheManager);

    remoteSourceCacheManager = new RemoteCacheManager("localhost", sourceServer.getPort());
    remoteSourceCacheManager.start();
    remoteSourceCache = remoteSourceCacheManager.getCache();

    ConfigurationBuilder clientBuilder =
        TestCacheManagerFactory.getDefaultCacheConfiguration(false);
    clientBuilder
        .loaders()
        .addStore(RemoteCacheStoreConfigurationBuilder.class)
        .hotRodWrapping(true)
        .addServer()
        .host("localhost")
        .port(sourceServer.getPort());
    targetCacheManager = TestCacheManagerFactory.createCacheManager(clientBuilder);
    targetCache = targetCacheManager.getCache();
    targetServer = TestHelper.startHotRodServer(targetCacheManager);

    remoteTargetCacheManager = new RemoteCacheManager("localhost", targetServer.getPort());
    remoteTargetCacheManager.start();
    remoteTargetCache = remoteTargetCacheManager.getCache();

    marshaller = remoteTargetCacheManager.getMarshaller();
  }
  @Override
  protected EmbeddedCacheManager createCacheManager() throws Exception {
    cacheManager = TestCacheManagerFactory.createCacheManager(hotRodCacheConfiguration());
    cache = cacheManager.getCache();

    hotRodServer = TestHelper.startHotRodServer(cacheManager);

    ConfigurationBuilder clientBuilder = new ConfigurationBuilder();
    clientBuilder.addServer().host("127.0.0.1").port(hotRodServer.getPort());
    clientBuilder.marshaller(new ProtoStreamMarshaller());
    remoteCacheManager = new RemoteCacheManager(clientBuilder.build());

    remoteCache = remoteCacheManager.getCache();

    // initialize client-side serialization context
    MarshallerRegistration.registerMarshallers(
        ProtoStreamMarshaller.getSerializationContext(remoteCacheManager));

    return cacheManager;
  }
 protected HotRodServer createHotRodServer() {
   return TestHelper.startHotRodServer(cacheManager);
 }