{
final Subject subject = TestPrincipalUtils.createTestSubject("user1");
final InetAddress inetAddress = InetAddress.getLocalHost();
final InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, 1);
AMQConnectionModel connectionModel = mock(AMQConnectionModel.class);
when(connectionModel.getRemoteAddress()).thenReturn(inetSocketAddress);
subject.getPrincipals().add(new ConnectionPrincipal(connectionModel));
Subject.doAs(subject, new PrivilegedExceptionAction<Object>()
{