use of org.jivesoftware.smackx.chatstates.ChatStateManager in project Smack by igniterealtime.
the class ChatStateIntegrationTest method testChatStateListeners.
@SmackIntegrationTest
public void testChatStateListeners() throws Exception {
ChatStateManager manOne = ChatStateManager.getInstance(conOne);
ChatStateManager manTwo = ChatStateManager.getInstance(conTwo);
// Add chatState listeners.
manTwo.addChatStateListener(this::composingListener);
manTwo.addChatStateListener(this::activeListener);
Chat chatOne = ChatManager.getInstanceFor(conOne).chatWith(conTwo.getUser().asEntityBareJid());
// Test, if setCurrentState works and the chatState arrives
manOne.setCurrentState(ChatState.composing, chatOne);
composingSyncPoint.waitForResult(timeout);
// Test, if the OutgoingMessageInterceptor successfully adds a chatStateExtension of "active" to
// an outgoing chat message and if it arrives at the other side.
Chat chat = ChatManager.getInstanceFor(conOne).chatWith(conTwo.getUser().asEntityBareJid());
chat.send("Hi!");
activeSyncPoint.waitForResult(timeout);
}
use of org.jivesoftware.smackx.chatstates.ChatStateManager in project Smack by igniterealtime.
the class ChatStateIntegrationTest method cleanup.
@AfterClass
public void cleanup() {
ChatStateManager manTwo = ChatStateManager.getInstance(conTwo);
manTwo.removeChatStateListener(this::composingListener);
manTwo.removeChatStateListener(this::activeListener);
}
Aggregations