code: @SuppressWarnings("unchecked")
    public static Object getProxiedObject(Object proxy)
    {
      if(Proxy.isProxyClass(proxy.getClass()))
      {
        InvocationHandler invocationHandler = Proxy.getInvocationHandler(proxy);
        if(invocationHandler instanceof ObjectProxy)
        {
          ObjectProxy objectProxy = (ObjectProxy) invocationHandler;
          // recursively fetch the proxy
          return getProxiedObject(objectProxy.getProxiedObject());
        }
        else
          return proxy;
      }
      else
        return proxy;
  
    }
docs: Given a proxy returns the object proxied. If the object is not a proxy, then return the object
  itself.
  
  @param proxy
  @return the proxied object (or proxy if not an object proxy)