2006-12-15 11:41:58 -05:00
|
|
|
package davmail.exchange;
|
|
|
|
|
|
|
|
import davmail.Settings;
|
2008-12-22 19:13:03 -05:00
|
|
|
import davmail.http.DavGatewaySSLProtocolSocketFactory;
|
2006-12-15 11:41:58 -05:00
|
|
|
|
|
|
|
/**
|
2009-10-30 11:13:06 -04:00
|
|
|
* Test Exchange session
|
2006-12-15 11:41:58 -05:00
|
|
|
*/
|
|
|
|
public class TestExchangeSession {
|
2007-05-09 19:37:24 -04:00
|
|
|
|
2009-10-30 11:13:06 -04:00
|
|
|
private TestExchangeSession() {
|
2007-05-09 19:37:24 -04:00
|
|
|
}
|
|
|
|
|
2009-10-30 11:13:06 -04:00
|
|
|
/**
|
|
|
|
* main method
|
|
|
|
* @param argv command line arg
|
|
|
|
*/
|
2006-12-15 11:41:58 -05:00
|
|
|
public static void main(String[] argv) {
|
2008-12-22 19:13:03 -05:00
|
|
|
// register custom SSL Socket factory
|
2007-05-09 19:37:24 -04:00
|
|
|
int currentArg = 0;
|
|
|
|
Settings.setConfigFilePath(argv[currentArg++]);
|
2006-12-15 11:41:58 -05:00
|
|
|
Settings.load();
|
|
|
|
|
2008-12-22 19:13:03 -05:00
|
|
|
DavGatewaySSLProtocolSocketFactory.register();
|
|
|
|
|
2008-12-04 06:50:31 -05:00
|
|
|
ExchangeSession session;
|
2006-12-15 11:41:58 -05:00
|
|
|
// test auth
|
|
|
|
try {
|
2008-10-31 13:12:30 -04:00
|
|
|
ExchangeSessionFactory.checkConfig();
|
2009-10-30 11:13:06 -04:00
|
|
|
session = ExchangeSessionFactory.getInstance(argv[currentArg++], argv[currentArg]);
|
2006-12-15 11:41:58 -05:00
|
|
|
|
2009-05-21 14:19:02 -04:00
|
|
|
ExchangeSession.Folder folder = session.getFolder("INBOX");
|
2009-10-30 11:13:06 -04:00
|
|
|
folder.loadMessages();
|
2006-12-15 11:41:58 -05:00
|
|
|
|
2009-06-24 11:18:50 -04:00
|
|
|
//session.purgeOldestTrashAndSentMessages();
|
2007-02-07 06:32:44 -05:00
|
|
|
|
2006-12-15 11:41:58 -05:00
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|