Allow services to provide a port. Tidied up unit tests.