public void connected(Glacier2.SessionHelper session) { // // Ignore callbacks during shutdown. // if (_exit) { return; } // // If the session has been reassigned avoid the spurious callback. // if (session != _session) { return; } Chat.ChatRoomCallbackPrx callback = Chat.ChatRoomCallbackPrxHelper.uncheckedCast( _session.addWithUUID(new ChatRoomCallbackI(this))); _chat = Chat.ChatSessionPrxHelper.uncheckedCast(_session.session()); try { _chat.begin_setCallback(callback).whenCompleted( delegate() { _username = ChatUtils.formatUsername(_info.Username); _info.save(); setState(ClientState.Connected); }, delegate(Ice.Exception ex) { destroySession(); }); } catch (Ice.CommunicatorDestroyedException) { //Ignore client session was destroyed. } }