Fixed another NPE in state machine
Merge branch 'development' into protocol-tests
Added some more tests for disconnect