@Test public void testSuccessfulProxyMethodCall() throws Exception { when(clientPool.acquire()).thenReturn(Futures.immediateFuture(client)); mockCallSuccess(client); ClientProxyImpl<AsyncSSLClient> proxy = new ClientProxyImpl<>(executor, typeLiteral, clientPool); assertThat(performEchoCall(proxy.get(), "foobar"), is("foobar")); verify(clientPool).acquire(); verify(clientPool).release(client, true); verifyNoMoreInteractions(clientPool); }
@Override @SuppressWarnings("unchecked") public synchronized C get() { return (C) this.enhancer.create( new Class[]{TProtocolFactory.class, TAsyncSSLClientManager.class, TNonblockingSSLTransport.class}, new Object[]{null, null, null}); }
ClientProxyImpl implements ClientProxy<C> { @Override @SuppressWarnings("unchecked") public synchronized C get() { return (C) this.enhancer.create( new Class[]{TProtocolFactory.class, TAsyncSSLClientManager.class, TNonblockingSSLTransport.class}, new Object[]{null, null, null}); } }
ClientProxyImpl implements ClientProxy<C> { @Override @SuppressWarnings("unchecked") public synchronized C get() { return (C) this.enhancer.create( new Class[]{TProtocolFactory.class, TAsyncSSLClientManager.class, TNonblockingSSLTransport.class}, new Object[]{null, null, null}); } @Inject  ClientProxyImpl(@Named("ClientProxyExecutor") ExecutorService executor,
                         TypeLiteral<C> type,
                         @Assisted final ClientPool<C> clientPool); }
ClientProxyImpl implements ClientProxy<C> { @Override @SuppressWarnings("unchecked") public synchronized C get() { return (C) this.enhancer.create( new Class[]{TProtocolFactory.class, TAsyncSSLClientManager.class, TNonblockingSSLTransport.class}, new Object[]{null, null, null}); } @Inject  ClientProxyImpl(@Named("ClientProxyExecutor") ExecutorService executor,
                         TypeLiteral<C> type,
                         @Assisted final ClientPool<C> clientPool); @Override @SuppressWarnings("unchecked") synchronized C get(); }
ClientProxyImpl implements ClientProxy<C> { @Override @SuppressWarnings("unchecked") public synchronized C get() { return (C) this.enhancer.create( new Class[]{TProtocolFactory.class, TAsyncSSLClientManager.class, TNonblockingSSLTransport.class}, new Object[]{null, null, null}); } @Inject  ClientProxyImpl(@Named("ClientProxyExecutor") ExecutorService executor,
                         TypeLiteral<C> type,
                         @Assisted final ClientPool<C> clientPool); @Override @SuppressWarnings("unchecked") synchronized C get();  }