Add exception handling for cases when client terminates connection with server