@Test(expected = IllegalArgumentException.class)
public void testNonSubjectSecurityContext() {
SubjectConnectionReference reference =
new SubjectConnectionReference(new ConnectionContext(), new ConnectionInfo(),
new DefaultEnvironment(), new SubjectAdapter());
reference.getConnectionContext().setSecurityContext(new SecurityContext("") {
@Override
public Set<Principal> getPrincipals() {
return null;
}