def create_resolver(ssl_options)
      return Unix.new(seed.downcase) if seed.downcase =~ Unix::MATCH

      family = (host == LOCALHOST) ? ::Socket::AF_INET : ::Socket::AF_UNSPEC
      error = nil
      ::Socket.getaddrinfo(host, nil, family, ::Socket::SOCK_STREAM).each do |info|
        begin
          specific_address = FAMILY_MAP[info[4]].new(info[3], port, host)
          socket = specific_address.socket(
            connect_timeout, ssl_options, connect_timeout: connect_timeout)
          socket.close
          return specific_address
        rescue IOError, SystemCallError, Error::SocketTimeoutError, Error::SocketError => e
          error = e
        end
      end
      raise error
    end
def create_resolver(ssl_options)
      return Unix.new(seed.downcase) if seed.downcase =~ Unix::MATCH

      family = (host == LOCALHOST) ? ::Socket::AF_INET : ::Socket::AF_UNSPEC
      error = nil
      ::Socket.getaddrinfo(host, nil, family, ::Socket::SOCK_STREAM).each do |info|
        begin
          specific_address = FAMILY_MAP[info[4]].new(info[3], port, host)
          socket = specific_address.socket(
            connect_timeout, ssl_options, connect_timeout: connect_timeout)
          socket.close
          return specific_address
        rescue IOError, SystemCallError, Error::SocketTimeoutError, Error::SocketError => e
          error = e
        end
      end
      raise error
    end
To determine which address the socket will connect to, the driver will
 attempt to connect to each IP address returned by Socket::getaddrinfo in
 sequence. Once a successful connection is made, a resolver with that
 IP address specified is returned. If no successful connection is
 made, the error made by the last connection attempt is raised.