properly setup and connect to an ipv6 endpoint

The resolving handler now tries to connect to each endpoint until
one works.