Updated test to loop on state for lost connection.