Code review comment: Fixed, I also changed the test to use equals as the results are repeatable.

Code under review:
public void testAdaptiveLoadBalancer() {
        LoadBalancer lb = new AdaptiveLoadBalancer("foo");

        List<Mirror.Entry> entries = Arrays.asList(new Mirror.Entry("foo/0/default", "tcp/bar:1"),
                new Mirror.Entry("foo/1/default", "tcp/bar:2"),
                new Mirror.Entry("foo/2/default", "tcp/bar:3"));
        List<LoadBalancer.NodeMetrics> weights = lb.getNodeWeights();

        for (int i = 0; i < 9999; i++) {
            LoadBalancer.Node node = lb.getRecipient(entries);
            assertNotNull(node);
        }

        long sentSum = 0;
        for (var metrics : weights) {
            assertTrue(10 > Math.abs(metrics.sent() - 3333));
            sentSum += metrics.sent();
        }
        assertEquals(9999, sentSum);

        for (var metrics : weights) {
            metrics.reset();
        }

        
        for (int i = 0; i < 9999; i++) {
            LoadBalancer.Node node = lb.getRecipient(entries);
            assertNotNull(node);
            if (node.entry.getName().contains("1")) {
                lb.received(node, false);
            } else if (node.entry.getName().contains("2")) {
                if ((i % 2) == 0) {
                    lb.received(node, false);
                }
            } else {
                if ((i % 4) == 0) {
                    lb.received(node, false);
                }
            }
        }

        sentSum = 0;
        long sumPending = 0;
        for (var metrics : weights) {
            System.out.println("m: s=" + metrics.sent() + " p=" + metrics.pending());
            sentSum += metrics.sent();
            sumPending += metrics.pending();
        }
        assertEquals(9999, sentSum);
        assertTrue(200 > Math.abs(sumPending -  2700));
        assertTrue( 100 > Math.abs(weights.get(0).sent() - 1780));
        assertTrue( 200 > Math.abs(weights.get(1).sent() - 5500));
        assertTrue( 100 > Math.abs(weights.get(2).sent() - 2650));
        assertTrue( 100 > Math.abs(weights.get(0).pending() - 1340));
        assertEquals( 0, weights.get(1).pending());
        assertTrue( 100 > Math.abs(weights.get(2).pending() - 1340));
    }

Line commented on: assertTrue(10 > Math.abs(metrics.sent() - 3333));

Revised code:
public void testAdaptiveLoadBalancer() {
        LoadBalancer lb = new AdaptiveLoadBalancer("foo", new Random(1));

        List<Mirror.Entry> entries = Arrays.asList(new Mirror.Entry("foo/0/default", "tcp/bar:1"),
                new Mirror.Entry("foo/1/default", "tcp/bar:2"),
                new Mirror.Entry("foo/2/default", "tcp/bar:3"));
        List<LoadBalancer.NodeMetrics> weights = lb.getNodeWeights();

        for (int i = 0; i < 9999; i++) {
            LoadBalancer.Node node = lb.getRecipient(entries);
            assertNotNull(node);
        }

        long sentSum = 0;
        for (var metrics : weights) {
            assertTrue(10 > Math.abs(metrics.sent() - 3333));
            sentSum += metrics.sent();
        }
        assertEquals(9999, sentSum);

        for (var metrics : weights) {
            metrics.reset();
        }

        
        for (int i = 0; i < 9999; i++) {
            LoadBalancer.Node node = lb.getRecipient(entries);
            assertNotNull(node);
            if (node.entry.getName().contains("1")) {
                lb.received(node, false);
            } else if (node.entry.getName().contains("2")) {
                if ((i % 2) == 0) {
                    lb.received(node, false);
                }
            } else {
                if ((i % 4) == 0) {
                    lb.received(node, false);
                }
            }
        }

        sentSum = 0;
        long sumPending = 0;
        for (var metrics : weights) {
            System.out.println("m: s=" + metrics.sent() + " p=" + metrics.pending());
            sentSum += metrics.sent();
            sumPending += metrics.pending();
        }
        assertEquals(9999, sentSum);
        assertEquals(2039, sumPending);
        assertEquals(1332, weights.get(0).sent());
        assertEquals(6645, weights.get(1).sent());
        assertEquals(2022, weights.get(2).sent());
        assertEquals(1020, weights.get(0).pending());
        assertEquals(0, weights.get(1).pending());
        assertEquals(1019, weights.get(2).pending());
    }