public void testConnectionStateListener() throws Exception
{
server.close();
final StringBuilder listenerSequence = new StringBuilder();
LeaderSelector selector = null;
Timing timing = new Timing();
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(100));
try
{
client.start();
timing.sleepABit();
LeaderSelectorListener listenerLeader = new LeaderSelectorListenerAdapter()
{
@Override
public void takeLeadership(CuratorFramework client) throws Exception
{
Thread.currentThread().join();
}
};
selector = new LeaderSelector(client, "/leader", listenerLeader);
selector.autoRequeue();
selector.start();
ConnectionStateListener listener1 = new ConnectionStateListener()
{
@Override
public void stateChanged(CuratorFramework client, ConnectionState newState)