Add tests for the DNS filter

  * Also fix some bugs found in the exception handling