handle disconnect
added test cases