Move the definition of AwsDomain to a variable

This allows overriding it from the tests.
Properly handle requests with a Host header containing a port
tests: Move the test config to a global variable
tests: Factor out TCP listener creation
Add support for retrying failed requests