@Test
public void testZKClient() throws Exception {

  File temp = FileUtil.createTempFile("flume-zk-test", "");
  temp.delete();
  temp.mkdir();
  temp.deleteOnExit();
  ZKInProcessServer zk = new ZKInProcessServer(3181, temp.getAbsolutePath());
  zk.start();
  ZKClient client = new ZKClient("localhost:3181");
  client.init();
  client.ensureDeleted("/test-flume", -1);
  assertTrue("Delete not successful!",
      client.exists("/test-flume", false) == null);
  client.ensureExists("/test-flume", "hello world".getBytes());
  Stat stat = new Stat();
  byte[] data = client.getData("/test-flume", false, stat);
  String dataString = new String(data);
  assertEquals("Didn't get expected 'hello world' from getData - "
      + dataString, dataString, "hello world");
  client.delete("/test-flume", stat.getVersion());
  assertTrue("Final delete not successful!", client.exists("/test-flume",
      false) == null);
  zk.stop();
}