@Test public void itShouldBeCreatedWhenThereIsAtLeastOneActiveSubSender() { RpcClientConnectionPoolStub pool = new RpcClientConnectionPoolStub(); RpcSenderStub connection = new RpcSenderStub(); pool.put(ADDRESS_2, connection); RpcStrategy firstAvailableStrategy = firstAvailable(servers(ADDRESS_1, ADDRESS_2)); assertNotNull(firstAvailableStrategy.createSender(pool)); }
@Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.isEmpty()) return null; return senders.get(0); }
RpcStrategyFirstAvailable implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.isEmpty()) return null; return senders.get(0); } }
RpcStrategyFirstAvailable implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.isEmpty()) return null; return senders.get(0); } private  RpcStrategyFirstAvailable(RpcStrategyList list); }
RpcStrategyFirstAvailable implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.isEmpty()) return null; return senders.get(0); } private  RpcStrategyFirstAvailable(RpcStrategyList list); static RpcStrategyFirstAvailable create(RpcStrategyList list); @Override Set<InetSocketAddress> getAddresses(); @Nullable @Override RpcSender createSender(RpcClientConnectionPool pool); }
RpcStrategyFirstAvailable implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.isEmpty()) return null; return senders.get(0); } private  RpcStrategyFirstAvailable(RpcStrategyList list); static RpcStrategyFirstAvailable create(RpcStrategyList list); @Override Set<InetSocketAddress> getAddresses(); @Nullable @Override RpcSender createSender(RpcClientConnectionPool pool);  }