public override Packet Handle(Packet packet)
        {
            if (packet.HasChild("mechanisms"))
            {
                var mechanisms = packet.GetChild("mechanisms").GetChildren("mechanism");

                if (mechanisms.Any(mechanism => mechanism.Value == "PLAIN-PW-TOKEN"))
                {
                    var pwAuth = new AuthenticationPlainPw(Session);
                    pwAuth.OnAuthentication += stanza => OnAuthenticated(stanza);
                    pwAuth.Authenticate();
                }
            }

            if (packet.HasChild("bind"))
            {
                var binder = new ResourceBinder(Session);
                binder.OnBinding += stanza => OnResourceBinding(stanza);
                binder.Bind(Session.Account.Resource);
            }

            return(packet);
        }
        public override Packet Handle(Packet packet)
        {
            if (packet.HasChild("mechanisms"))
            {
                var mechanisms = packet.GetChild("mechanisms").GetChildren("mechanism");

                if (mechanisms.Any(mechanism => mechanism.Value == "PLAIN-PW-TOKEN"))
                {
                    var pwAuth = new AuthenticationPlainPw(Session);
                    pwAuth.OnAuthentication += stanza => OnAuthenticated(stanza);
                    pwAuth.Authenticate();
                }
            }

            if (packet.HasChild("bind"))
            {
                var binder = new ResourceBinder(Session);
                binder.OnBinding += stanza => OnResourceBinding(stanza);
                binder.Bind(Session.Account.Resource);
            }

            return packet;
        }