AergoPool implements ResourcePool<AergoApi> { @Override public AergoApi borrowResource() { return new AergoClientBuilder() .withEndpoint(hostnameAndPort) .build(); }  @Override AergoApi borrowResource(); @Override void returnResource(final AergoApi resource);  }
@Test @SuppressWarnings("unchecked") @PrepareForTest(NettyChannelBuilder.class) public void testBorrowResource() throws Exception { final NettyConnectStrategy connectStrategy = mock(NettyConnectStrategy.class); final NettyChannelBuilder managedChannel = mock(NettyChannelBuilder.class); whenNew(NettyConnectStrategy.class).withAnyArguments().thenReturn(connectStrategy); when(connectStrategy.connect()).thenReturn(managedChannel); final AergoPool pool = new AergoPool(randomUUID().toString()); assertNotNull(pool.borrowResource()); }