Merge pull request #13 from bozzzzo/master

propagate name resolution exceptions in the correct thread context
Do not even invoke getLocalHost() if not necessary

Some systems are getting exceptions from getLocalHost() and
setting isUseLocalHost() had no positive effect on them.