lib/net/tcp_client/tcp_client.rb
def ssl_verify(ssl_socket, address)
      unless OpenSSL::SSL.verify_certificate_identity(ssl_socket.peer_cert, address.host_name)
        domains = extract_domains_from_cert(ssl_socket.peer_cert)
        ssl_socket.close
        message = "#connect SSL handshake failed due to a hostname mismatch. Request address was: '#{address.to_s}'" +
                  "  Certificate valid for hostnames: #{domains.map { |d| "'#{d}'"}.join(',')}"
        logger.error message if respond_to?(:logger)
        raise ConnectionFailure.new(message, address.to_s)
      end
    end
def ssl_verify(ssl_socket, address)
      unless OpenSSL::SSL.verify_certificate_identity(ssl_socket.peer_cert, address.host_name)
        domains = extract_domains_from_cert(ssl_socket.peer_cert)
        ssl_socket.close
        message = "#connect SSL handshake failed due to a hostname mismatch. Request address was: '#{address.to_s}'" +
                  "  Certificate valid for hostnames: #{domains.map { |d| "'#{d}'"}.join(',')}"
        logger.error message if respond_to?(:logger)
        raise ConnectionFailure.new(message, address.to_s)
      end
    end
Raises Net::TCPClient::ConnectionFailure if the peer certificate does not match its hostname