xmppSession.addIQListener(new IQListener() {
@Override
public void handle(IQEvent e) {
IQ iq = e.getIQ();
if (e.isIncoming() && !e.isConsumed() && iq.getType() == IQ.Type.SET && (iq.getFrom() == null || iq.getFrom().equals(xmppSession.getConnectedResource().asBareJid()))) {
Block block = iq.getExtension(Block.class);
if (block != null) {
List<Jid> pushedContacts = new ArrayList<>();
synchronized (blockedContacts) {
for (Jid item : block.getItems()) {
blockedContacts.add(item);
pushedContacts.add(item);
}
}
xmppSession.send(iq.createResult());