Overhaul of the MBean proxy code

In particular, allow application code to create proxies.