/** * Configure XMPP connection to use provided ping timeout and reply timeout. */ private void setServerSettings() { // Enable auto-connect ReconnectionManager.getInstanceFor(connection).enableAutomaticReconnection(); // Set reconnection policy to increasing delay ReconnectionManager.getInstanceFor(connection) .setReconnectionPolicy(ReconnectionPolicy.RANDOM_INCREASING_DELAY); // Set ping interval PingManager.getInstanceFor(connection).setPingInterval(pingTimeout); // Specifies when incoming message delivery receipt requests // should be automatically acknowledged with a receipt. DeliveryReceiptManager.getInstanceFor(connection).setAutoReceiptMode(AutoReceiptMode.always); SmackConfiguration.setDefaultPacketReplyTimeout(packetReplyTimeout); logger.debug("Successfully set server settings: {} - {}", new Object[] { pingTimeout, packetReplyTimeout }); }