public List<ObjectName> getGemfireFederatedBeans() throws IOException {
    Set<ObjectName> allBeans = con.queryNames(null, null);
    // Each locator will have a "Manager" bean that is a part of the above query,
    // representing the ManagementAdapter.
    // This bean is registered (and so included in its own queries),
    // but *not* federated (and so is not included in another locator's bean queries).
    return allBeans.stream()
        .filter(b -> b.toString().contains("GemFire"))
        .filter(b -> !b.toString().contains("service=Manager,type=Member,member=locator"))
        .sorted()
        .collect(toList());
  }
Rule constructor

@param portSupplier The JMX server port to connect to
geode-dunit/src/main/java/org/apache/geode/test/junit/rules/MBeanServerConnectionRule.java