package cn.hhj.proxy; import cn.hhj.disovery.IServiceDiscovery; import cn.hhj.disovery.impl.ServiceDiscoveryWithZk; import cn.hhj.proxy.remote.RemoteInvocationHandler; import java.lang.reflect.Proxy; public class RpcProxyClient { private IServiceDiscovery serviceDiscovery=new ServiceDiscoveryWithZk(); public T getClientProxy(final Class interfaceCls,String version){ return (T) Proxy.newProxyInstance(interfaceCls.getClassLoader(), new Class[]{interfaceCls}, new RemoteInvocationHandler(serviceDiscovery,version)); } }