@Override
 public Bundle autoDiscover(String userName, String password) throws RemoteException {
   HostAuth hostAuth = new HostAuth();
   hostAuth.mLogin = userName;
   hostAuth.mPassword = password;
   hostAuth.mFlags = HostAuth.FLAG_AUTHENTICATE | HostAuth.FLAG_SSL;
   hostAuth.mPort = 443;
   return new EasSyncService().tryAutodiscover(ExchangeService.this, hostAuth);
 }
 public void testValidateAccount() throws Exception {
   setupAccountMailboxAndMessages(0);
   HostAuth auth = new HostAuth();
   auth.mAddress = mAccount.mEmailAddress;
   auth.mProtocol = "eas";
   auth.mLogin = mAccount.mDisplayName;
   auth.mPassword = "******";
   auth.mPort = 80;
   EasSyncService eas = getTestService(mAccount, mMailbox);
   Bundle bundle = eas.validateAccount(auth, mProviderContext);
   assertEquals("14.1", bundle.get(EmailServiceProxy.VALIDATE_BUNDLE_PROTOCOL_VERSION));
   assertEquals(
       MessagingException.NO_ERROR, bundle.get(EmailServiceProxy.VALIDATE_BUNDLE_RESULT_CODE));
 }
  public void testTryAutodiscover() throws RemoteException, IOException {
    String userName = "******";
    String password = "******";

    EasSyncService service = new EasSyncService();
    Bundle bundle1 = service.tryAutodiscover(userName, password);
    Bundle bundle2 = new Bundle();
    bundle2.putInt(EmailServiceProxy.AUTO_DISCOVER_BUNDLE_ERROR_CODE, MessagingException.NO_ERROR);
    HostAuth hostAuth = new HostAuth();
    hostAuth.mAddress = "google.com";
    hostAuth.mLogin = userName;
    hostAuth.mPassword = password;
    hostAuth.mPort = 443;
    hostAuth.mProtocol = "eas";
    hostAuth.mFlags = HostAuth.FLAG_SSL | HostAuth.FLAG_AUTHENTICATE;
    bundle2.putParcelable(EmailServiceProxy.AUTO_DISCOVER_BUNDLE_HOST_AUTH, hostAuth);
    assertEquals(bundle2.toString(), bundle1.toString());
  }