Implementation of dynamic proxies in java