Split connect out into init/connect for use in testing