Add test for Dns Client and fix some bugs in the impl