if (notifs!=null && notifs.length!=0) isBroadcaster=true;
//We first create the proxy for the remote mbean. If broadcasting supported, then it adds the broadcasting interface
Object proxy=MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, iface, isBroadcaster);
//We get the underlying invocation handler, needed for the wrapper handler. The wrapper adds the mbean interface functionality
//and integrates JMX invocation handler.
InvocationHandler h=Proxy.getInvocationHandler(proxy);
InvocationHandler wrapper=new JMXInvocationHandler(oname,mbeanServer, mbeanServer.getMBeanInfo(objectName), h);
Class[] ifaces;
if (isBroadcaster) {
ifaces=new Class[]{iface, NotificationEmitter.class, MBean.class};
}else ifaces=new Class[]{iface, MBean.class};
//finally, we create the proxy with the appropriate classloader, the interfaces and the invocation handler