Add exception handlings of SocketError, HostUnreach, and
ConnectRefused.