ImapMailReceiver: Check folder.isOpen before idle

Increase wait timeout for message in the ImapMailReceiverTests

https://build.spring.io/browse/INT-MASTERSPRING40-556/
This commit is contained in:
Artem Bilan
2018-12-15 14:30:59 -05:00
parent 355479f935
commit 3f48d2043b
2 changed files with 4 additions and 2 deletions

View File

@@ -179,7 +179,9 @@ public class ImapMailReceiver extends AbstractMailReceiver {
try {
this.pingTask = this.scheduler.schedule(this.idleCanceler,
new Date(System.currentTimeMillis() + this.cancelIdleInterval));
imapFolder.idle();
if (imapFolder.isOpen()) {
imapFolder.idle();
}
}
finally {
imapFolder.removeMessageCountListener(this.messageCountListener);

View File

@@ -250,7 +250,7 @@ public class ImapMailReceiverTests {
assertThat(received.getPayload(), equalTo(TestMailServer.MailServer.MailHandler.MESSAGE + "\r\n"));
}
}
assertNotNull(channel.receive(10000)); // new message after idle
assertNotNull(channel.receive(20000)); // new message after idle
assertNull(channel.receive(100)); // no new message after second and third idle
verify(logger).debug("Canceling IDLE");