partitioned connection manager code to suit unit testing