apache/curator — pull request #58 by gopikori (2014-12-28 14:03:35+00:00)
Title: If zookeeper is down when discovery is started, it fails to register when the zookeeper comes up for the first time.

**The issue:** If zookeeper is down when discovery is started, it fails to register when the zookeeper comes up for the first time. However, if the zookeeper is restarted again, it discovery will connect and register the service instance correctly.
**Cause :** This happened because *org.apache.curator.x.discovery.details.ServiceDiscoveryImpl.stateChanged()* considered only *ConnectionState.RECONNECTED* state and not *ConnectionState.CONNECTED*. This caused the first connection to be ignored, while subsequent connection recoveries worked fine.

This pull request has fix for the same and a test case for it.