Only lookup the hostname once

This is a sample implementation that caches the lookup for #22 .

I'm not sure how to handle multiple IP addresses, so I've left it to pick the first one that's returned.

Maybe an extra switch that tells it "round-robin between multiple IP addresses if available" could be good?