Search in sources :

Example 6 with ImapConfig

use of com.zimbra.cs.mailclient.imap.ImapConfig in project zm-mailbox by Zimbra.

the class TestImap method withLiteralPlus.

private void withLiteralPlus(boolean lp, RunnableTest test) throws Exception {
    ImapConfig config = connection.getImapConfig();
    boolean oldLp = config.isUseLiteralPlus();
    config.setUseLiteralPlus(lp);
    try {
        test.run();
    } finally {
        config.setUseLiteralPlus(oldLp);
    }
}
Also used : ImapConfig(com.zimbra.cs.mailclient.imap.ImapConfig)

Example 7 with ImapConfig

use of com.zimbra.cs.mailclient.imap.ImapConfig in project zm-mailbox by Zimbra.

the class TestImapThrottle method connect.

private ImapConnection connect() throws IOException {
    ImapConfig config = new ImapConfig(HOST);
    config.setPort(PORT);
    config.setAuthenticationId(USER);
    config.getLogger().setLevel(Log.Level.trace);
    ImapConnection connection = new ImapConnection(config);
    connection.connect();
    connection.login(PASS);
    connection.select("INBOX");
    return connection;
}
Also used : ImapConfig(com.zimbra.cs.mailclient.imap.ImapConfig) ImapConnection(com.zimbra.cs.mailclient.imap.ImapConnection)

Example 8 with ImapConfig

use of com.zimbra.cs.mailclient.imap.ImapConfig in project zm-mailbox by Zimbra.

the class TestImapClient method testYahoo.

@Test
public void testYahoo() throws Exception {
    ImapConfig config = new ImapConfig();
    config.getLogger().setLevel(Log.Level.trace);
    config.setHost("imap.mail.yahoo.com");
    config.setAuthenticationId("dacztest");
    connection = new ImapConnection(config);
    connection.connect();
    IDInfo id = new IDInfo();
    id.put("guid", "unknown");
    connection.id(id);
    connection.login("test1234");
    char delim = connection.getDelimiter();
    assertEquals(0, delim);
    createTestMailbox("Large", 10000);
}
Also used : ImapConfig(com.zimbra.cs.mailclient.imap.ImapConfig) IDInfo(com.zimbra.cs.mailclient.imap.IDInfo) ImapConnection(com.zimbra.cs.mailclient.imap.ImapConnection) Test(org.junit.Test)

Example 9 with ImapConfig

use of com.zimbra.cs.mailclient.imap.ImapConfig in project zm-mailbox by Zimbra.

the class TestImapUtil method getImapInputStream.

private static ImapInputStream getImapInputStream(String[] folders) {
    StringBuilder sb = new StringBuilder();
    for (String folder : folders) {
        sb.append("* LIST () \"/\" \"").append(folder).append("\"\r\n");
    }
    ImapConfig config = new ImapConfig();
    return new ImapInputStream(new ByteArrayInputStream(Ascii.getBytes(sb.toString())), config);
}
Also used : ImapConfig(com.zimbra.cs.mailclient.imap.ImapConfig) ByteArrayInputStream(java.io.ByteArrayInputStream) ImapInputStream(com.zimbra.cs.mailclient.imap.ImapInputStream)

Example 10 with ImapConfig

use of com.zimbra.cs.mailclient.imap.ImapConfig in project zm-mailbox by Zimbra.

the class TestImap method connect.

private ImapConnection connect() throws IOException {
    ImapConfig config = new ImapConfig(HOST);
    config.setPort(PORT);
    config.setAuthenticationId(USER);
    config.getLogger().setLevel(Log.Level.trace);
    ImapConnection connection = new ImapConnection(config);
    connection.connect();
    connection.login(PASS);
    connection.select("INBOX");
    return connection;
}
Also used : ImapConfig(com.zimbra.cs.mailclient.imap.ImapConfig) ImapConnection(com.zimbra.cs.mailclient.imap.ImapConnection)

Aggregations

ImapConfig (com.zimbra.cs.mailclient.imap.ImapConfig)11 ImapConnection (com.zimbra.cs.mailclient.imap.ImapConnection)6 ServiceException (com.zimbra.common.service.ServiceException)2 ImapInputStream (com.zimbra.cs.mailclient.imap.ImapInputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 ZMimeMessage (com.zimbra.common.zmime.ZMimeMessage)1 ImapAppender (com.zimbra.cs.datasource.imap.ImapAppender)1 CommandFailedException (com.zimbra.cs.mailclient.CommandFailedException)1 IDInfo (com.zimbra.cs.mailclient.imap.IDInfo)1 HashMap (java.util.HashMap)1 Random (java.util.Random)1 MimeMessage (javax.mail.internet.MimeMessage)1 LoginException (javax.security.auth.login.LoginException)1