Creates a java.lang.reflect.Proxy that implements
all the java interfaces given as parameters.
If handler is a function it receives the name of method as first argument followed by the parameters of original method call.
Otherwise the handler is treated as a class instance and corresponding method is invoked with parameters of original method call.