Refactored some more logic into the transport base class and improve tests.