class BytebuddyProxy implements Proxy {

    @Override
    public <T> T getProxy(Class<T> interfaceClass, Invoker proxyInvoker) {

        Class<? extends T> cls = PROXY_CLASS_MAP.get(interfaceClass);
        if (cls == null) {
            cls = new ByteBuddy()
                .subclass(interfaceClass)
                .method(
                    ElementMatchers.isDeclaredBy(interfaceClass).or(ElementMatchers.isEquals())
                        .or(ElementMatchers.isToString().or(ElementMatchers.isHashCode())))
                .intercept(MethodDelegation.to(new BytebuddyInvocationHandler(proxyInvoker), "handler"))
                .make()
                .load(interfaceClass.getClassLoader(), ClassLoadingStrategy.Default.INJECTION)
                .getLoaded();

            PROXY_CLASS_MAP.put(interfaceClass, cls);
        }
        try {
            return cls.newInstance();
        } catch (Throwable t) {
            throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_PROXY_CONSTRUCT, "bytebuddy"), t);
        }

    }

}