refactor method Xmpp\Connection:encode()