selector = new LeaderSelector(client, "/leader", listener);
selector.start();
Assert.assertTrue(timing.awaitLatch(isLeaderLatch));
selector.interruptLeadership();
Assert.assertTrue(timing.awaitLatch(losingLeaderLatch));
}
finally
{
Closeables.closeQuietly(selector);
Closeables.closeQuietly(client);