Fixed bug - server crushes when the client disconnects in a certain way.
Add tests for client disconnection case.