Clean up connection code and ensure Broker URI gets set.