@Test public void testInvokeInternal() { MyClass myClass = new MyClass(); Assert.assertEquals("myMethod", myClass.myMethod()); MyInterface proxy = (MyInterface)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { MyInterface.class }, new TestInvocationHandler()); Assert.assertEquals("This is only a test", proxy.myMethod()); }
protected abstract Object invokeInternal(Object proxy, Method method, Object[] arguments) throws Throwable;
BaseInvocationHandler implements InvocationHandler { protected abstract Object invokeInternal(Object proxy, Method method, Object[] arguments) throws Throwable; }
BaseInvocationHandler implements InvocationHandler { protected abstract Object invokeInternal(Object proxy, Method method, Object[] arguments) throws Throwable;  }
BaseInvocationHandler implements InvocationHandler { protected abstract Object invokeInternal(Object proxy, Method method, Object[] arguments) throws Throwable;  @Override Object invoke(Object proxy, Method method, Object[] arguments); }
BaseInvocationHandler implements InvocationHandler { protected abstract Object invokeInternal(Object proxy, Method method, Object[] arguments) throws Throwable;  @Override Object invoke(Object proxy, Method method, Object[] arguments);  }