Won't this testcase fail if you're running without an internet connection? It might be better to use the request module, disable following redirects and check the Location header for the hostname..?