Tests: Fix runtime errors and bugs with new stateserver unittest.