Implement (re)connection handling