@Test
  public void testDeletesNodeWhenClosed() throws Exception {
    CuratorFramework curator = newCurator();
    SlotZnode node = createZnode(curator);
    assertTrue(node.start(30, TimeUnit.SECONDS));
    String path = null;
    try {
      path = node.getActualPath();
      assertNodeExists(curator, path);
    } finally {
      node.close(); // After closing the path is set to null...
    }
    assertNodeDoesNotExist(curator, path);
  }
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