use of com.zimbra.cs.mailclient.imap.ImapConnection in project zm-mailbox by Zimbra.
the class ImapProxy method writeRequest.
private ImapConnection writeRequest(final byte[] payload) throws ImapProxyException {
ImapConnection conn = connection;
if (conn == null) {
throw new ImapProxyException("proxy connection already closed");
}
// proxy the request over to the remote server
OutputStream remote = conn.getOutputStream();
if (remote == null) {
dropConnection();
throw new ImapProxyException("proxy connection already closed");
}
try {
remote.write(payload);
remote.flush();
} catch (IOException e) {
throw new ImapProxyException(e);
}
return conn;
}
use of com.zimbra.cs.mailclient.imap.ImapConnection in project zm-mailbox by Zimbra.
the class TestImapClient method testYahoo.
@Ignore("deprecated")
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);
}
use of com.zimbra.cs.mailclient.imap.ImapConnection in project zm-mailbox by Zimbra.
the class TestImapClient method connect.
private void connect(MailConfig.Security security) throws IOException {
if (config == null) {
config = getConfig(security);
}
System.out.println("---------");
connection = new ImapConnection(config);
connection.connect();
}
use of com.zimbra.cs.mailclient.imap.ImapConnection in project zm-mailbox by Zimbra.
the class TestImapViaImapDaemon method testZimbraCommandsNonAdminUser.
@Test
public void testZimbraCommandsNonAdminUser() throws Exception {
Account acct = TestUtil.getAccount(USER);
AuthenticatorFactory authFactory = new AuthenticatorFactory();
authFactory.register(ZimbraAuthenticator.MECHANISM, ZimbraClientAuthenticator.class);
ImapConfig config = new ImapConfig(imapHostname);
config.setMechanism(ZimbraAuthenticator.MECHANISM);
config.setAuthenticatorFactory(authFactory);
config.setPort(imapPort);
config.setAuthenticationId(acct.getName());
config.getLogger().setLevel(Log.Level.trace);
ImapConnection conn = new ImapConnection(config);
conn.connect();
conn.authenticate(AuthProvider.getAuthToken(acct).getEncoded());
try {
conn.reloadLocalConfig();
fail("should not be able to run X-ZIMBRA-RELOADLC command with a non-admin auth token");
} catch (CommandFailedException cfe) {
assertEquals("must be authenticated as admin with X-ZIMBRA auth mechanism", cfe.getError());
}
try {
conn.flushCache("all");
fail("should not be able to run X-ZIMBRA-FLUSHCACHE command with a non-admin auth token");
} catch (CommandFailedException cfe) {
assertEquals("must be authenticated as admin with X-ZIMBRA auth mechanism", cfe.getError());
}
}
use of com.zimbra.cs.mailclient.imap.ImapConnection 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;
}
Aggregations