Connect imap use email-java fail

I use Aspose.email.java connect imap.the program throw exception.
Exception in thread “main” OperationCanceledException: Operation has been canceled
[Ljava.lang.StackTraceElement;@76f2b07d
at com.aspose.email.zep.b(SourceFile:664)
at com.aspose.email.zep.A(SourceFile:591)
at com.aspose.email.zael.a(SourceFile:170)
at com.aspose.email.zjm.a(SourceFile:716)
at com.aspose.email.zep.r(SourceFile:274)
at com.aspose.email.zaes.e(SourceFile:44)
at com.aspose.email.zaes.r(SourceFile:17)
at com.aspose.email.zep.a(SourceFile:632)
at com.aspose.email.ImapClient.beginListFolders(SourceFile:12773)
at com.aspose.email.ImapClient.listFolders(SourceFile:13327)
at com.aspose.email.ImapClient.listFolders(SourceFile:13233)

souce code is:
public class TestImap {

public static void test1() throws MessagingException {
	Properties props = new Properties();
	Session session = Session.getDefaultInstance(props, null);
	 Store store     = session.getStore("imap");
     store.connect("ip", "email", "password");
     Folder[] folders;
     
     folders=store.getDefaultFolder().list();
     for (Folder folder:folders) {
    	 System.out.println(folder.getName());
     }
     
     
}

public static void test2() {
	ImapClient client=null;
	try {
		client = new ImapClient("ip", port,"email", "password");;
		
		ImapFolderInfoCollection folders = client.listFolders();
		for (ImapFolderInfo folder:folders) {
			System.out.println(folder.getName());
		}
	}finally {
		if (client!=null)
			client.dispose();
	}
}		

public static void main(String[] args) throws MessagingException {
	test1();
	test2();
}

}

test1 use javamail, is ok, test2 has a exception.
How can I slove it?thanks

@jinie,

I suggest you to please visit this documentation link to see how to connect to server using IMAP client. If there is still an issue then please share client access details with us.

@mudassir.fayyaz
I had read the document link.
My email server is domino 9.0.1FP10, no ssl setting. so we use simple code to test connection

client = new ImapClient(“ip”, 143,“email”, “password”);
client.listFolders();

The program still throw this exception.
Exception in thread “main” OperationCanceledException: Operation has been canceled

if I add securityoption to source code,as flow

client = new ImapClient(“ip”, 143,“email”, “password”);
client.setSecurityOptions(SecurityOptions.None);
client.listFolders();

The program throw another exception.
Exception in thread “main” AsposeException: startIndex + length cannot exceed length of string.
Parameter name: length
** —> class com.aspose.email.system.exceptions.ArgumentOutOfRangeException: startIndex + length cannot exceed length of string.**
Parameter name: length

From the server log,we see it had login sucess.but client.listFolders() has exception.

By the way,we use outlook test this account,it work fine and can see all folders.

@jinie,

I request you to please share the working sample code along with test account credentials reproducing the issue on your end. Can you please also confirm that if your credentials are working while connecting using MS Outlook.