Assert.assertFalse(messageDeliveryReceiptsManager.isEnabled());
}
@Test
public void testListeners() throws IOException {
TestXmppSession connection1 = new TestXmppSession();
MessageDeliveryReceiptsManager messageDeliveryReceiptsManager = connection1.getExtensionManager(MessageDeliveryReceiptsManager.class);
MessageDeliveredListener messageDeliveredListener = new MessageDeliveredListener() {
@Override
public void messageDelivered(MessageDeliveredEvent e) {
}
};
messageDeliveryReceiptsManager.addMessageDeliveredListener(messageDeliveredListener);
Assert.assertEquals(messageDeliveryReceiptsManager.messageDeliveredListeners.size(), 1);
messageDeliveryReceiptsManager.removeMessageDeliveredListener(messageDeliveredListener);
Assert.assertEquals(messageDeliveryReceiptsManager.messageDeliveredListeners.size(), 0);
messageDeliveryReceiptsManager.addMessageDeliveredListener(new MessageDeliveredListener() {
@Override
public void messageDelivered(MessageDeliveredEvent e) {
}
});
connection1.close();
// Listeners should be cleared now.
Assert.assertEquals(messageDeliveryReceiptsManager.messageDeliveredListeners.size(), 0);
}