policy.addServerPermission(new JMXPrincipal("test"), new AuthPermission("doAsPrivileged"));
policy.addServerPermission(new JMXPrincipal("test"), new SocketPermission("localhost:" + url.getPort(), "listen"));
policy.addServerPermission(new JMXPrincipal("test"), new SocketPermission("*:1024-" + url.getPort(), "accept"));
cntor = JMXConnectorFactory.connect(cntorServer.getAddress(), clientEnv);
addPermission(new MBeanTrustPermission("*"));
policy.addServerPermission(new JMXPrincipal("delegate"), new MBeanPermission("*", "instantiate, registerMBean, getAttribute"));
policy.addServerPermission(new JMXPrincipal("test"), new SubjectDelegationPermission(JMXPrincipal.class.getName() + ".delegate"));
Set delegates = new HashSet();
delegates.add(new JMXPrincipal("delegate"));