MBeanServerConnection adaptor = jmxc.getMBeanServerConnection();
ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
Class<?>[] ifaces = {JBossASServer.class};
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
JBossASServer server = (JBossASServer) Proxy.newProxyInstance(tcl, ifaces, handler);
server.shutdown();
System.out.println("Shutdown message has been posted to the server.");
System.out.println("Server shutdown may take a while - check logfiles for completion");
jmxc.close();
}