Added a test to check lastActiveAt is cleared when a connection stops

#2754