agent: Improving test reliability
Support rejoin after leave. Fixes #110.