Add configurable port for testing

Make sure the port is a number even when it comes from an environment
variable (which is a string).