@Test
  public void testDeletedAndRecreatedNodeWhenSessionReconnects() throws Exception {
    CuratorFramework curator = newCurator();
    CuratorFramework observer = newCurator();
    SlotZnode node = createZnode(curator);
    assertTrue(node.start(30, TimeUnit.SECONDS));
    String originalPath = node.getActualPath();
    assertNodeExists(observer, originalPath);
    Trigger deletedTrigger = Trigger.deleted();
    observer.checkExists().usingWatcher(deletedTrigger).forPath(node.getActualPath());
    killSession(curator);
    // Make sure the node got deleted.
    assertTrue(deletedTrigger.firedWithin(30, TimeUnit.SECONDS));
    // Check for it to be recreated.
    Trigger createdTrigger = Trigger.created();
    Stat stat = observer.checkExists().usingWatcher(createdTrigger).forPath(originalPath);
    assertTrue(stat != null || createdTrigger.firedWithin(30, TimeUnit.SECONDS));
  }
See SlotZNode; some tests (and the setup) are c/p-ed or modified from Curator.
llap-client/src/test/org/apache/hadoop/hive/llap/registry/impl/TestSlotZnode.java