Add tests for the new DNS filter functionality

  * Also fix some bugs found in the exception handling