public static void setInvocationHandler(Object instance, InvocationHandler handler) {
    try {
      Field handlerField = instance.getClass().getDeclaredField(FIELD_NAME_HANDLER);
      handlerField.setAccessible(true);
      handlerField.set(instance, handler);
    } catch (NoSuchFieldException e) {
      throw new IllegalArgumentException("Not a valid proxy instance", e);
    } catch (IllegalAccessException e) {
      // Should not be thrown, we just set the field to accessible.
      throw new AssertionError(e);
    }
  }
Sets the proxy's {@link InvocationHandler}.

<p>If you create a proxy with {@link #build()}, the proxy will already have a handler set,
provided that you configured one with {@link #handler(InvocationHandler)}.

<p>If you generate a proxy class with {@link #buildProxyClass()}, instances of the proxy class
will not automatically have a handler set, and it is necessary to use this method with each
instance.

@throws IllegalArgumentException if the object supplied is not a proxy created by this class.
android/android_framework/dex-maker/src/main/java/com/android/dx/stock/ProxyBuilder.java