public Optional<Group> takeGroup(Set<Integer> rejectedGroups) {
        synchronized (this) {
            Optional<GroupStatus> best = scheduler.takeNextGroup(rejectedGroups);

            if (best.isPresent()) {
                GroupStatus gs = best.get();
                gs.allocate();
                Group ret = gs.group;
                log.fine(() -> "Offering <" + ret + "> for query connection");
                return Optional.of(ret);
            } else {
                return Optional.empty();
            }
        }
    }
@Test
    void requireThatLoadBalancerServesClusteredGroups() {
        Node n1 = new Node("test", 0, "test-node1", 0);
        Node n2 = new Node("test", 1, "test-node2", 0);
        Node n3 = new Node("test", 0, "test-node3", 1);
        Node n4 = new Node("test", 1, "test-node4", 1);
        LoadBalancer lb = new LoadBalancer(List.of(new Group(0, List.of(n1,n2)), new Group(1,List.of(n3,n4))), LoadBalancer.Policy.ROUNDROBIN);

        Optional<Group> grp = lb.takeGroup(null);
        assertTrue(grp.isPresent());
    }