code: public static InvocationHandler getInvocationHandlerStatic(Object proxy) {
          try {
              final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD);
              AccessController.doPrivileged(new SetAccessiblePrivilege(field));
              return (InvocationHandler) field.get(proxy);
          } catch (NoSuchFieldException e) {
              throw new RuntimeException("Could not find invocation handler on generated proxy", e);
          } catch (IllegalArgumentException e) {
              throw new RuntimeException("Object is not a proxy of correct type", e);
          } catch (IllegalAccessException e) {
              throw new RuntimeException(e);
          }
      }
docs: Gets the {@link InvocationHandler} for a given proxy instance. This method is less efficient than
  {@link #getInvocationHandler(Object)}, however it will work for any proxy, not just proxies from a specific factory
  instance.
  
  @param proxy the proxy
  @return the invocation handler