ServicePoolProxies { public static <S> void close(S dynamicProxy) { try { Closeables.close(getPool(dynamicProxy), true); } catch (IOException e) { throw new AssertionError(); } } private  ServicePoolProxies(); static boolean isProxy(Object dynamicProxy); static void close(S dynamicProxy); static int getNumValidEndPoints(S dynamicProxy); static int getNumBadEndPoints(S dynamicProxy); static HealthCheckResults checkForHealthyEndPoint(S dynamicProxy); static com.bazaarvoice.ostrich.ServicePool<S> getPool(S dynamicProxy);  }
@Test public void testClose() throws IOException { @SuppressWarnings("unchecked") ServicePool<Service> pool = mock(ServicePool.class); Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), pool, mock(PartitionContextSupplier.class), true); ServicePoolProxies.close(service); verify(pool).close(); }