Fix connection detection logic.

The fact that we have socket back from IO::select, does not necessarily
mean that mean that we can actually ready and/or write to it.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
@lamont-granquist I am just fixing the issue at hand. We could re-write it to make it simple (why not?), but I guess it was modelled after `ec2_metadata.rb` (as I just noticed) which see to be originally added by @btm - not sure why was his reason to do this, I guess he was trying to do the Right Thing(tm), see: http://spin.atomicobject.com/2013/09/30/socket-connection-timeout-ruby/