Revert "dns: query_type is always equal to reply_type"

This reverts commit d1eea74331e3f34408874f090a34d9cca5d72247 because I
realized that it's better to save query and class when we make the request
rather than when we receive the response.
dns: record query type, class at request not at response

So we can safely check the type, class also of the request
that have failed, and we can add more tests.
test: dns: add missing checks for get_failure() value
dns: only compute rtt when it makes sense

While adding tests for rtt, also generally add more tests.
dns: tests: replace throw runtime_error with safer idiom

The idiom by which we throw a runtime_error when a test fails is
broken because libevent's loop does not know about exceptions.

So, when an exception is thrown, we exit from the loop without the
loop knowing that we exited.

Therefore, next time we invoke the loop libevent complains since
it thinks that we are nesting loops.

As a consequence, all subsequent test fails because we cannot
re-enter into libevent's loop.

To fix this, use a safer idiom: when a callback that was not expected
to be called is called, set a boolean to true, break the loop, and
then check after the loop whether the boolean is true or not.

While there, also avoid throwing exception in the cancel-is-idempotent
tests, where we don't need to signal any error in the delayed call.