diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index dfe4d5662..dbbf0e7d5 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -1146,7 +1146,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { @Override public void setReplyTimeout(long timeout) { - replyTimeout = timeout; + if (Long.MAX_VALUE - System.currentTimeMillis() < timeout) { + throw new IllegalArgumentException("Extremely long reply timeout"); + } + else { + replyTimeout = timeout; + } } private SmackConfiguration.UnknownIqRequestReplyMode unknownIqRequestReplyMode = SmackConfiguration.getUnknownIqRequestReplyMode();