public static JMXServiceURL buildJMXServiceURL(int rmiRegistryPort, int rmiConnectorPort)
    throws IOException {
    // Build jmxURL
    StringBuilder url = new StringBuilder();
    url.append("service:jmx:rmi://localhost:");
    url.append(rmiConnectorPort);
    url.append("/jndi/rmi://localhost:");
    url.append(rmiRegistryPort);
    url.append("/jmxrmi");

    return new JMXServiceURL(url.toString());

  }
workaround for HBASE-11146 master and regionserver are in 1 JVM in standalone mode only 1 JMX
instance is allowed, otherwise there is port conflict even if we only load regionserver
coprocessor on master
hbase-server/src/main/java/org/apache/hadoop/hbase/JMXListener.java