add timeout to address resolve

I am not 100% sure, but I guess having a timeout on DNS resolve make sense. Also I had to stop using `Socket.getaddrinfo` in order to make the timeout block to work.

@durran Let me know if you see any problem with the solution.