JBossDetector extends AbstractServerDetector { @Override public void addMBeanServers(Set<MBeanServerConnection> servers) { try { Class locatorClass = Class.forName("org.jboss.mx.util.MBeanServerLocator"); Method method = locatorClass.getMethod("locateJBoss"); servers.add((MBeanServer) method.invoke(null)); } catch (ClassNotFoundException e) { } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } }  ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor); @Override void jvmAgentStartup(Instrumentation instrumentation); @Override /** {@inheritDoc} */ void addMBeanServers(Set<MBeanServerConnection> servers); static final String JBOSS_AS_MANAGEMENT_ROOT_SERVER; static final int LOGGING_DETECT_TIMEOUT; static final int LOGGING_DETECT_INTERVAL; }
@Test public void addMBeanServers() { replay(server); detector.addMBeanServers(new HashSet<MBeanServerConnection>()); }