{IsLocalProxyFactoryInterceptor.singleton, new NotToBeInvokedInterceptor()};
PojiProxy handler = new PojiProxy(KEY, null, interceptors);
Class<?>[] interfaces = new Class<?>[]
{Calculator.class};
// create the proxy
Calculator calculator = (Calculator) Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, handler);
// register with dispatcher too, since the IsLocalProxyFactoryInterceptor
// looks for the key in the dispatcher
Dispatcher.singleton.registerTarget(KEY, new CalculatorImpl());
try
{
int result = calculator.add(1, 2);
logger.info("Successfully invoked method. Result = " + result);
Assert.assertEquals("Incorrect result from calculator", result, 3);
}
catch (IllegalInvocationException iie)
{