Fixed unit test build and added invalid port test