def connect_or_error( addr, deadline, errors )
      timeout = deadline - Time.now.to_f
      raise Timeout, "Could not connect to #{host}:#{port}" if timeout <= 0
      return connect_nonblock( addr, timeout )
    rescue Error => e
      errors << e
      return false
    end
def connect_or_error( addr, deadline, errors )
      timeout = deadline - Time.now.to_f
      raise Timeout, "Could not connect to #{host}:#{port}" if timeout <= 0
      return connect_nonblock( addr, timeout )
    rescue Error => e
      errors << e
      return false
    end
Internal: Connect to the destination or raise an error.

 Connect to the address or capture the error of the connection

 addr     - An address returned from Socket.getaddrinfo()
 deadline - the after which we should raise a timeout error
 errors   - a collection of errors to append an error too should we have one.

 Make an attempt to connect to the given address. If it is successful,
 return the socket.

 Should the connection fail, append the exception to the errors array and
 return false.