Search in sources :

Example 1 with XmppConnectionStressTest

use of org.igniterealtime.smack.XmppConnectionStressTest in project Smack by igniterealtime.

the class XmppConnectionIntegrationTest method allToAllMessageSendTest.

@SmackIntegrationTest(connectionCount = 4)
public void allToAllMessageSendTest(List<AbstractXMPPConnection> connections) throws InterruptedException, NotAllMessagesReceivedException, ErrorsWhileSendingOrReceivingException {
    final long seed = 42;
    // 100
    final int messagesPerConnection = 3;
    // 512
    final int maxPayloadChunkSize = 16;
    // 32
    final int maxPayloadChunks = 4;
    // true
    final boolean intermixMessages = false;
    XmppConnectionStressTest.Configuration stressTestConfiguration = new XmppConnectionStressTest.Configuration(seed, messagesPerConnection, maxPayloadChunkSize, maxPayloadChunks, intermixMessages);
    XmppConnectionStressTest stressTest = new XmppConnectionStressTest(stressTestConfiguration);
    stressTest.run(connections, timeout);
    final Level connectionStatsLogLevel = Level.FINE;
    if (LOGGER.isLoggable(connectionStatsLogLevel)) {
        if (connections.get(0) instanceof ModularXmppClientToServerConnection) {
            for (XMPPConnection connection : connections) {
                ModularXmppClientToServerConnection xmppC2sConnection = (ModularXmppClientToServerConnection) connection;
                ModularXmppClientToServerConnection.Stats stats = xmppC2sConnection.getStats();
                LOGGER.log(connectionStatsLogLevel, "Connections stats for " + xmppC2sConnection + ":\n{}", stats);
            }
        }
    }
}
Also used : Level(java.util.logging.Level) XmppConnectionStressTest(org.igniterealtime.smack.XmppConnectionStressTest) ModularXmppClientToServerConnection(org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection) SmackIntegrationTest(org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest)

Aggregations

Level (java.util.logging.Level)1 XmppConnectionStressTest (org.igniterealtime.smack.XmppConnectionStressTest)1 SmackIntegrationTest (org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest)1 ModularXmppClientToServerConnection (org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection)1