Don't allow port numbers greater than 65535.
Started reworking the unit tests by grouping them into functional areas and adding missing tests.