@BeforeClass
  public static void setUpBeforeClass() throws Exception {
    conf = UTIL.getConfiguration();
    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
    rmiRegistryPort = UTIL.randomFreePort();
    conf.setInt("master.rmi.registry.port", rmiRegistryPort);
    conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
    UTIL.startMiniCluster();
    admin = UTIL.getConnection().getAdmin();
  }
Test case for JMX Connector Server.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java