Try all endpoints when connecting to peer

We were previously relying on the first resolved endpoint to be
correct. We prettyprinted each endpoint, but only tried to connect
to the first one. This is wrong - any given endpoint may fail, so
we must attempt to connect to each resolved endpoint in sequence
until one works. boost::asio::connect (the free function) does
this.