Change the port
Factor out the dnsPort/httpPort from the test

makes the code simpler and you don't have to check if you reused a
port or not. Starting point can even be made random so you can multiple
tests after each other. Most call now look like newTestServer("", "",
""), which indicates this can be further abstracted.