@Override
    public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException {
      if (!hasAccess) {
        throw new AccessDeniedException("Insufficient permissions to stop master");
      }
    }
This tests to validate the HMaster's ConnectorServer after unauthorised shutdown call.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java