use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class ImapConnectionTest method open_authCramMd5.
@Test
public void open_authCramMd5() throws Exception {
settings.setAuthType(AuthType.CRAM_MD5);
MockImapServer server = new MockImapServer();
preAuthenticationDialog(server, "AUTH=CRAM-MD5");
server.expect("2 AUTHENTICATE CRAM-MD5");
server.output("+ " + ByteString.encodeUtf8("<0000.000000000@example.org>").base64());
server.expect("dXNlciA2ZjdiOTcyYjk5YTI4NDk4OTRhN2YyMmE3MGRhZDg0OQ==");
server.output("2 OK Success");
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_authXoauthWithSaslIr.
@Test
public void open_authXoauthWithSaslIr() throws Exception {
settings.setAuthType(AuthType.XOAUTH2);
when(oAuth2TokenProvider.getToken("user", OAuth2TokenProvider.OAUTH2_TIMEOUT)).thenReturn("token");
MockImapServer server = new MockImapServer();
preAuthenticationDialog(server, "SASL-IR AUTH=XOAUTH AUTH=XOAUTH2");
server.expect("2 AUTHENTICATE XOAUTH2 " + XOAUTH_STRING);
server.output("2 OK Success");
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 RealImapConnectionTest method open_authExternal.
@Test
public void open_authExternal() throws Exception {
settings.setAuthType(AuthType.EXTERNAL);
MockImapServer server = new MockImapServer();
preAuthenticationDialog(server, "AUTH=EXTERNAL");
server.expect("2 AUTHENTICATE EXTERNAL " + ByteString.encodeUtf8(USERNAME).base64());
server.output("2 OK Success");
postAuthenticationDialogRequestingCapabilities(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 RealImapConnectionTest method executeSingleCommand_withOkResponse_shouldReturnResult.
@Test
public void executeSingleCommand_withOkResponse_shouldReturnResult() throws Exception {
MockImapServer server = new MockImapServer();
simpleOpenDialog(server, "");
server.expect("4 CREATE Folder");
server.output("4 OK Folder created");
ImapConnection imapConnection = startServerAndCreateImapConnection(server);
List<ImapResponse> result = imapConnection.executeSimpleCommand("CREATE Folder");
assertEquals(result.size(), 1);
server.verifyConnectionStillOpen();
server.verifyInteractionCompleted();
}
use of com.fsck.k9.mail.store.imap.mockserver.MockImapServer in project k-9 by k9mail.
the class RealImapConnectionTest method isIdleCapable_withoutIdleCapability.
@Test
public void isIdleCapable_withoutIdleCapability() throws Exception {
MockImapServer server = new MockImapServer();
ImapConnection imapConnection = simpleOpen(server);
boolean result = imapConnection.isIdleCapable();
assertFalse(result);
server.shutdown();
}
Aggregations