Clean up code to be more testable. Add test cases for named and numeric ports in HTTP health checks. Improve tests.