@Test public void invoke() throws Throwable { URL url = mock(URL.class); InvokerCreator invokeCreator = mock(InvokerCreator.class); Invoker invoker = mock(Invoker.class); when(invokeCreator.createSyncInvoker(Callable.class, url)).thenReturn(invoker); Result result = mock(Result.class); doReturn(result).when(invoker).invoke(ArgumentMatchers.<Invocation>any()); when(result.recreate()).thenReturn(true); assertEquals(true, new PeerInvocationHandler(Callable.class, url, invokeCreator).invoke(null, Callable.class.getMethod("call"), new Object[]{})); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return invokerCreator.createSyncInvoker(proxyIface, url).invoke(new SwiftInvocation(method, args)).recreate(); }
PeerInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return invokerCreator.createSyncInvoker(proxyIface, url).invoke(new SwiftInvocation(method, args)).recreate(); } }
PeerInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return invokerCreator.createSyncInvoker(proxyIface, url).invoke(new SwiftInvocation(method, args)).recreate(); } PeerInvocationHandler(Class<?> proxyIface, URL url, InvokerCreator invokerCreator); }
PeerInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return invokerCreator.createSyncInvoker(proxyIface, url).invoke(new SwiftInvocation(method, args)).recreate(); } PeerInvocationHandler(Class<?> proxyIface, URL url, InvokerCreator invokerCreator); @Override Object invoke(Object proxy, Method method, Object[] args); }
PeerInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return invokerCreator.createSyncInvoker(proxyIface, url).invoke(new SwiftInvocation(method, args)).recreate(); } PeerInvocationHandler(Class<?> proxyIface, URL url, InvokerCreator invokerCreator); @Override Object invoke(Object proxy, Method method, Object[] args);  }