### Question:
RibbonRedisProxyClient { public Jedis callWithRibbon(final Map<String,Pool<Jedis>> poolMap) { return LoadBalancerCommand.<Jedis>builder() .withLoadBalancer(loadBalancer) .withRetryHandler(retryHandler) .build() .submit(new ServerOperation<Jedis>() { @Override public Observable<Jedis> call(Server server) { try { if(logger.isDebugEnabled()){ logger.debug("call :{}",server.getId()); } Jedis jedis = poolMap.get(server.getId()).getResource(); return Observable.just(jedis); } catch (Exception e) { return Observable.error(e); } } }).toBlocking().first(); } RibbonRedisProxyClient(ILoadBalancer loadBalancer); Jedis callWithRibbon(final Map<String,Pool<Jedis>> poolMap); List<Server> getAllServers(); LoadBalancerStats getLoadBalancerStats(); static Logger logger; }### Answer:
@Test(expected = RuntimeException.class) public void callWithRibbon() { Map<String,Pool<Jedis>> poolMap = new HashMap<>(); List<Server> serverList= ribbonRedisProxyClient.getAllServers(); MockJedisConnectionFactory factory =new MockJedisConnectionFactory(); for(Server s : serverList){ if(poolMap.containsKey(s.getHost())){ continue; } factory.setHostName(s.getHost()); factory.setPort(s.getPort()); poolMap.put(s.getId(),factory.mockCreatePool()); } Jedis jedis= ribbonRedisProxyClient.callWithRibbon(poolMap); }