@Override
  protected void before(Description description) throws Exception {
    // do not auto connect if port is not set
    if (portSupplier == null) {
      return;
    }

    // do not auto connect if no ConnectionConfiguration is defined.
    ConnectionConfiguration config = description.getAnnotation(ConnectionConfiguration.class);
    if (config == null) {
      return;
    }

    connect(portSupplier.get(), config.user(), config.password());
  }
Rule constructor

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