test: don't let the port number exceed the legal range