Пример #1
0
  @Test
  public void testDigestAuthentication() throws Exception {
    log.info("testDigestAuthentication - Begin");
    config.saslMechanisms = Collections.singleton(DIGEST_MD5);

    JMXRemotingServer remotingServer = new JMXRemotingServer(config);
    remotingServer.start();

    Map<String, Object> env = new HashMap<String, Object>(1);
    env.put(JMXConnector.CREDENTIALS, new String[] {"DigestUser", "DigestPassword"});

    JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env);

    assertNotNull(connector.getConnectionId());

    connector.close();

    // Now Try A Bad Password
    env.put(JMXConnector.CREDENTIALS, new String[] {"DigestUser", "BadPassword"});
    try {
      JMXConnectorFactory.connect(serviceURL, env);
      fail("Expected exception not thrown.");
    } catch (IOException expected) {
    }

    remotingServer.stop();
  }
Пример #2
0
  @Before
  public void initialise() throws MalformedURLException {
    String bindAddress = System.getProperty(BIND_ADDRESS_PROPERTY, DEFAULT_BIND_ADDRESS);
    config = new JMXRemotingConfig();
    config.host = bindAddress;

    serviceURL = new JMXServiceURL(PROTOCOL, bindAddress, DEFAULT_PORT);
  }
Пример #3
0
  @Test
  public void testLocalAuthentication() throws Exception {
    log.info("testLocalAuthentication - Begin");
    config.saslMechanisms = Collections.singleton(JBOSS_LOCAL_USER);

    JMXRemotingServer remotingServer = new JMXRemotingServer(config);
    remotingServer.start();

    Map<String, Object> env = new HashMap<String, Object>(1);

    JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env);

    assertNotNull(connector.getConnectionId());

    connector.close();

    remotingServer.stop();
  }