Unit test for getPort()