while(runIt) {
try {
disconnect(store, mainFolder);
log.info("Connecting to store/floder...");
final Session session = Session.getInstance(options.genProperties());
session.setDebug(options.isDebug());
final URLName imapUrlName = options.genImapUrlName();
store = (IMAPStore) session.getStore(imapUrlName);
final InternalConnectionListener connectionListener = new InternalConnectionListener();
//store.addConnectionListener(connectionListener);
store.connect(imapUrlName.getHost(), imapUrlName.getPort(), imapUrlName.getUsername(), imapUrlName.getPassword());
mainFolder = (IMAPFolder) store.getFolder(options.getImapFolder());