Do not even invoke getLocalHost() if not necessary

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