EndpointURI uri = endpoint.getEndpointURI();
String encoding = endpoint.getEncoding();
String user = (uri.getUser() != null ? URLDecoder.decode(uri.getUser(), encoding) : null);
String pass = (uri.getPassword() != null ? URLDecoder.decode(uri.getPassword(), encoding) : null);
store.connect(uri.getHost(), uri.getPort(), user, pass);
folder = store.getFolder(castConnector().getMailboxFolder());
ensureFolderIsOpen(folder);
if (castConnector().getMoveToFolder() != null)