Test server restart

Following #1667, if I open connection during restart test, it will fail.