@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;
  }
  public void testPutAndGet() throws Exception {
    User user = createUser();
    remoteCache.put(1, user);

    // try to get the object through the local cache interface and check it's the same object we put
    assertEquals(1, cache.keySet().size());
    byte[] key = (byte[]) cache.keySet().iterator().next();
    Object localObject = cache.get(key);
    assertNotNull(localObject);
    assertTrue(localObject instanceof byte[]);
    Object unmarshalledObject =
        ProtobufUtil.fromWrappedByteArray(
            ProtoStreamMarshaller.getSerializationContext(remoteCacheManager),
            (byte[]) localObject);
    assertTrue(unmarshalledObject instanceof User);
    assertUser((User) unmarshalledObject);

    // get the object through the remote cache interface and check it's the same object we put
    User fromRemoteCache = remoteCache.get(1);
    assertUser(fromRemoteCache);
  }