simplify _test_port()