@Test public void oneAvailableWebSocketServerTest() { ServerInstance serverInstance = new ServerInstance("dummy","dummy","localhost",false,-1,81); serverInstance.setAvailable(true); ServerStats serverStats = new ServerStats(); serverStats.setServerInstance(serverInstance); RandomLoadBalancer lb = new RandomLoadBalancer(); ServerStats stat = lb.choose(Lists.newArrayList(serverStats)); Assert.assertEquals(stat,serverStats); }
@Override public ServerStats choose(List<ServerStats> availableServerStats) { int index = random.nextInt(availableServerStats.size()); return availableServerStats.get(index); }
RandomLoadBalancer implements LoadBalancer { @Override public ServerStats choose(List<ServerStats> availableServerStats) { int index = random.nextInt(availableServerStats.size()); return availableServerStats.get(index); } }
RandomLoadBalancer implements LoadBalancer { @Override public ServerStats choose(List<ServerStats> availableServerStats) { int index = random.nextInt(availableServerStats.size()); return availableServerStats.get(index); }  }
RandomLoadBalancer implements LoadBalancer { @Override public ServerStats choose(List<ServerStats> availableServerStats) { int index = random.nextInt(availableServerStats.size()); return availableServerStats.get(index); }  @Override ServerStats choose(List<ServerStats> availableServerStats); }
RandomLoadBalancer implements LoadBalancer { @Override public ServerStats choose(List<ServerStats> availableServerStats) { int index = random.nextInt(availableServerStats.size()); return availableServerStats.get(index); }  @Override ServerStats choose(List<ServerStats> availableServerStats);  }