How to mask the sending messages!

How to mask the messages that have sent by click “send” button?I want to catch the output packet and stop it,Finally, send a new message by new thread. thanks in advance!

SparkManager.getConnection().addPacketWriterInterceptor()

Take a look in Smack API Javadocs to see how it works.

Hope Helped