use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class ImapConnectionTest method sendContinuation.
@Test
public void sendContinuation() throws Exception {
settings.setAuthType(AuthType.PLAIN);
MockImapServer server = new MockImapServer();
simpleOpenDialog(server, "IDLE");
server.expect("4 IDLE");
server.output("+ idling");
server.expect("DONE");
ImapConnection imapConnection = startServerAndCreateImapConnection(server);
imapConnection.open();
imapConnection.sendCommand("IDLE", false);
imapConnection.readResponse();
imapConnection.sendContinuation("DONE");
server.waitForInteractionToComplete();
server.verifyConnectionStillOpen();
server.verifyInteractionCompleted();
}
use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class ImapConnectionTest method open_withIoExceptionDuringListCommand_shouldThrow.
@Test
public void open_withIoExceptionDuringListCommand_shouldThrow() throws Exception {
settings.setAuthType(AuthType.PLAIN);
settings.setUseCompression(true);
MockImapServer server = new MockImapServer();
simplePreAuthAndLoginDialog(server, "");
server.expect("3 LIST \"\" \"\"");
server.output("* Now what?");
ImapConnection imapConnection = startServerAndCreateImapConnection(server);
try {
imapConnection.open();
fail("Exception expected");
} catch (IOException ignored) {
}
server.verifyConnectionClosed();
server.verifyInteractionCompleted();
}
use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class ImapConnectionTest method open_authPlainWithoutAuthPlainCapability_shouldUseLoginMethod.
@Test
public void open_authPlainWithoutAuthPlainCapability_shouldUseLoginMethod() throws Exception {
settings.setAuthType(AuthType.PLAIN);
MockImapServer server = new MockImapServer();
preAuthenticationDialog(server);
server.expect("2 LOGIN \"" + USERNAME + "\" \"" + PASSWORD + "\"");
server.output("2 OK LOGIN completed");
simplePostAuthenticationDialog(server);
ImapConnection imapConnection = startServerAndCreateImapConnection(server);
imapConnection.open();
server.verifyConnectionStillOpen();
server.verifyInteractionCompleted();
}
use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class ImapConnectionTest method open_withStartTlsButWithoutStartTlsCapability_shouldThrow.
@Test
public void open_withStartTlsButWithoutStartTlsCapability_shouldThrow() throws Exception {
settings.setConnectionSecurity(ConnectionSecurity.STARTTLS_REQUIRED);
MockImapServer server = new MockImapServer();
preAuthenticationDialog(server);
ImapConnection imapConnection = startServerAndCreateImapConnection(server);
try {
imapConnection.open();
fail("Expected exception");
} catch (CertificateValidationException e) {
//FIXME: CertificateValidationException seems wrong
assertEquals("STARTTLS connection security not available", e.getMessage());
}
server.verifyConnectionClosed();
server.verifyInteractionCompleted();
}
use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class ImapConnectionTest method open_withNegativeResponseToListCommand.
@Test
public void open_withNegativeResponseToListCommand() throws Exception {
settings.setAuthType(AuthType.PLAIN);
settings.setUseCompression(true);
MockImapServer server = new MockImapServer();
simplePreAuthAndLoginDialog(server, "");
server.expect("3 LIST \"\" \"\"");
server.output("3 NO");
ImapConnection imapConnection = startServerAndCreateImapConnection(server);
imapConnection.open();
server.verifyConnectionStillOpen();
server.verifyInteractionCompleted();
}
Aggregations