Add tests for SRV and CNAME resolution and some fixes