AergoClientImpl implements AergoClient { @Override public void close() { try { final Context context = contextStorage.get(); final GrpcClient grpcClient = context.get(GRPC_CLIENT); if (null == grpcClient) { throw new HerajException("No grpc client"); } grpcClient.close(); } catch (HerajException e) { throw e; } catch (Exception e) { throw new HerajException(e); } } AergoClientImpl(final ContextStorage<Context> contextStorage); @Override ChainIdHash getCachedChainIdHash(); @Override void cacheChainIdHash(final ChainIdHash chainIdHash); @Override void close();  }
@Test public void testClose() { final Context context = EmptyContext.getInstance().withValue(GRPC_CLIENT, new GrpcClientImpl()); final ContextStorage<Context> contextStorage = new UnmodifiableContextStorage(context); final AergoClientImpl aergoClient = new AergoClientImpl(contextStorage); aergoClient.close(); }