use of com.fsck.k9.mail.transport.mockServer.MockSmtpServer in project k-9 by k9mail.
the class SmtpTransportTest method open_withAutomaticAuthAndNoTransportSecurityAndAuthPlainExtension_shouldThrow.
@Test
public void open_withAutomaticAuthAndNoTransportSecurityAndAuthPlainExtension_shouldThrow() throws Exception {
MockSmtpServer server = new MockSmtpServer();
server.output("220 localhost Simple Mail Transfer Service Ready");
server.expect("EHLO [127.0.0.1]");
server.output("250-localhost Hello client.localhost");
server.output("250 AUTH PLAIN LOGIN");
server.expect("QUIT");
server.output("221 BYE");
SmtpTransport transport = startServerAndCreateSmtpTransport(server, AuthType.AUTOMATIC, ConnectionSecurity.NONE);
try {
transport.open();
fail("Exception expected");
} catch (MessagingException e) {
assertEquals("Update your outgoing server authentication setting. AUTOMATIC auth. is unavailable.", e.getMessage());
}
server.verifyConnectionClosed();
server.verifyInteractionCompleted();
}
Aggregations