How to Connect to Amazon WorkMail by Using EWS in Java?

i am trying to connect Amazon WorkMail by using EWS in java please provide help
I am doing below code but not get so please provide code
final String mailboxUri = "https://servername.com/EWS/Exchange.asmx.";
final String domain = “imap.mail.us-east-1.awsapps.com”;
final String username = “*****@*******.awsapps.com”;
final String password = “1qaz@WSX”;
NetworkCredential credentials = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);
ExchangeMailboxInfo mailboxInfo = client.getMailboxInfo();
System.out.println("Mailbox URI: " + mailboxInfo.getMailboxUri());
System.out.println("Inbox folder URI: " + mailboxInfo.getInboxUri());

@David_jack,
Thank you for contacting support. I will reply to you as soon as possible.

@David_jack,
Unfortunately, EWSClient class has not been tested with Amazon WorkMail accounts. I logged the issue with ID EMAILJAVA-34956 in our tracking system. Our development team will investigate the capabilities of EWSClient class to work with Amazon WorkMail. We will inform you of any progress.

Documents: Working with Exchange EWS Client
API Reference: EWSClient Class

@Andrey_Potapov
Thank you , I will wait please resolve as soon as possible.

@David_jack,
Our development team confirmed the capability of EWSClient to work with Amazon WorkMail.

For Server, type the endpoint matching the AWS Region where your mailbox is located.

  • us-west-2
    https://ews.mail.us-west-2.awsapps.com/EWS/Exchange.asmx

  • us-east-1
    https://ews.mail.us-east-1.awsapps.com/EWS/Exchange.asmx

  • eu-west-1
    https://ews.mail.eu-west-1.awsapps.com/EWS/Exchange.asmx

Set up a connection on your side like this:

final String mailboxUri = "https://ews.mail.us-east-1.awsapps.com/EWS/Exchange.asmx";
final String domain = "";
final String username = "***@***.awsapps.com";
final String password = "***";
NetworkCredential credentials = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);
ExchangeMailboxInfo mailboxInfo = client.getMailboxInfo();
System.out.println("Mailbox URI: " + mailboxInfo.getMailboxUri());
System.out.println("Inbox folder URI: " + mailboxInfo.getInboxUri());

Documents: Setting up Microsoft Outlook clients for Amazon WorkMail