Add changes from DNS-resolution patch

https://issues.apache.org/jira/browse/ZOOKEEPER-1506