def connect
      # Calculate our timeout deadline
      deadline = Time.now.to_f + connect_timeout

      # Lookup destination address, we only want    IPv4             , TCP
      addrs      = ::Socket.getaddrinfo(host, port, ::Socket::AF_INET, ::Socket::SOCK_STREAM )
      errors     = []
      conn_error = lambda { raise errors.first }
      sock       = nil

      addrs.find( conn_error ) do |addr|
        sock = connect_or_error( addr, deadline, errors )
      end
      return sock
    end
def connect
      # Calculate our timeout deadline
      deadline = Time.now.to_f + connect_timeout

      # Lookup destination address, we only want    IPv4             , TCP
      addrs      = ::Socket.getaddrinfo(host, port, ::Socket::AF_INET, ::Socket::SOCK_STREAM )
      errors     = []
      conn_error = lambda { raise errors.first }
      sock       = nil

      addrs.find( conn_error ) do |addr|
        sock = connect_or_error( addr, deadline, errors )
      end
      return sock
    end
Internal:

 Connect to the remote host in a non-blocking fashion.

 Raise Error if there is a failure connecting.

 Return the ::Socket on success