private void checkConnector() throws Exception {
    // Check whether HMaster JMX Connector server can be connected
    JMXConnector connector = null;
    try {
      connector = JMXConnectorFactory
        .connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
    } catch (IOException e) {
      if (e.getCause() instanceof ServiceUnavailableException) {
        Assert.fail("Can't connect to ConnectorServer.");
      }
    }
    Assert.assertNotNull("JMXConnector should not be null.", connector);
    connector.close();
  }
This tests to validate the HMaster's ConnectorServer after unauthorised shutdown call.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java