def resolve(hostnames)
      ips = {}
      hostnames.each do |hostname|
        infos = nil
        attempts = RETRY_MAX_ATTEMPTS
        begin
          infos = Socket.getaddrinfo(hostname, 443, Socket::AF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP)
        rescue Exception => e
          if attempts > 0
            attempts -= 1
            retry
          else
            logger.error "Failed to resolve hostnames (#{e.class.name}: #{e.message})"
            raise e
          end
        end

        # Randomly permute the addrinfos of each hostname to help spread load.
        infos.shuffle.each do |info|
          ip = info[3]
          ips[ip] = hostname
        end
      end
      ips
    end
def resolve(hostnames)
      ips = {}
      hostnames.each do |hostname|
        infos = nil
        attempts = RETRY_MAX_ATTEMPTS
        begin
          infos = Socket.getaddrinfo(hostname, 443, Socket::AF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP)
        rescue Exception => e
          if attempts > 0
            attempts -= 1
            retry
          else
            logger.error "Failed to resolve hostnames (#{e.class.name}: #{e.message})"
            raise e
          end
        end

        # Randomly permute the addrinfos of each hostname to help spread load.
        infos.shuffle.each do |info|
          ip = info[3]
          ips[ip] = hostname
        end
      end
      ips
    end
Resolve a list of hostnames to a hash of Hostname => IP Addresses

 The purpose of this method is to lookup all IP addresses per hostname and
 build a lookup hash that maps IP addresses back to their original hostname
 so we can perform TLS hostname verification.

 === Parameters
 @param <[String]> Hostnames to resolve

 === Return
 @return [Hash]
   * :key [<String>] a key (IP Address) that accepts a hostname string as it's value