diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java index 719788ae..c858c273 100644 --- a/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java @@ -224,10 +224,15 @@ public void run() { while (!shuttingDown.get() && !Thread.interrupted()) { try { if(is == null) { - if (disconnectedSinceTime == null){ - disconnectedSinceTime = new AtomicLong(System.currentTimeMillis()); - } + if (disconnectedSinceTime == null) { + disconnectedSinceTime = new AtomicLong(System.currentTimeMillis()); + } + if (streamURI.toString().contains("replay")) { + // When a replay stream is finished, close the stream + doClose(); + } else { reconnect(); + } } if(is != null) { processor.process(is,stats);