// Training
ServicePoint sp1 = ((MBeanRegistrationContribution) mBeanList.get(0)).getServicePoint();
Object mBean1 = registry.getService("test.management.MBean1", Runnable.class);
ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
server.registerMBean(mBean1, on1);
ObjectInstance oin1 = new ObjectInstance(on1, mBean1.getClass().getName());
serverControl.setReturnValue(oin1);
Object mBean2 = registry.getService("test.management.MBean2", Runnable.class);
ObjectName on2 = new ObjectName("hivemind:name=bean2");
server.registerMBean(mBean2, on2);
serverControl.setReturnValue(new ObjectInstance(on2, mBean2.getClass().getName()));
// This is a special case. A class without interface
Object mBean3 = registry.getService("test.management.MBean3", MBeanNonInterfaceTestService.class);
ObjectName on3 = new ObjectName("hivemind:name=bean3");
server.registerMBean(mBean3, on3);
serverControl.setReturnValue(new ObjectInstance(on3, mBean3.getClass().getName()));
// Call from unregisterBean
server.getObjectInstance(on1);
serverControl.setReturnValue(oin1);