{
X500Principal principal = new X500Principal("CN=person, DC=example, DC=com, O=My Company Ltd, L=Newbury, ST=Berkshire, C=GB");
UsernamePrincipal expectedPrincipal = new UsernamePrincipal("person@example.com");
SaslServer saslServer = _manager.createSaslServer("EXTERNAL", "example.example.com", principal);
AuthenticationResult result = _manager.authenticate(saslServer, new byte[0]);
assertNotNull(result);
assertEquals("Expected authentication to be successful",
AuthenticationResult.AuthenticationStatus.SUCCESS,
result.getStatus());
assertOnlyContainsWrapped(expectedPrincipal, result.getPrincipals());
assertEquals("person@example.com", saslServer.getAuthorizationID());
}