There is a connect timeout set automatically in the client based on the
session timeout divided by the number of servers in the cluster. You will
see a SessionTimeout exception if you exceed this connect timeout without
successfully connecting to one of the servers.
I would recommend using a higher-level client than the one that ships with
ZooKeeper, or else you have to build all of this in.
Even if you want to build your own, it would probably be useful reading the
documentation for something like Curator, which explains the choices that
client made to do this:

On Mon, Mar 24, 2014 at 12:48 PM, Dan Hopkins <[EMAIL PROTECTED]>wrote:
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB