Is the Closed not sent by the connectionActor? If so then this test is racy (i.e. it could potentially take a while for that flag to return true). Better watch the actor and `expectMsgType[Terminated]`.