@@ -0,0 +1,2059 @@
+package io.reactivesocket.lease;%0A%0Aimport io.reactivesocket.Frame;%0Aimport io.reactivesocket.internal.Responder;%0Aimport org.junit.Test;%0A%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Mockito.mock;%0A%0Apublic class FairLeaseGovernorTest %7B%0A%0A    @Test(timeout = 10_000L)%0A    public void testAcceptRefuseLease() throws InterruptedException %7B%0A        int n = 10;%0A        FairLeaseGovernor governor = new FairLeaseGovernor(n, 100, TimeUnit.MILLISECONDS);%0A        Responder responder = mock(Responder.class);%0A        Frame frame = mock(Frame.class);%0A%0A        governor.register(responder);%0A        Thread.sleep(10);%0A%0A        assertTrue(%22First request is accepted%22, governor.accept(responder, frame));%0A        for (int i = 1; i %3C n; i++) %7B%0A            assertTrue(%22Subsequent requests are accepted%22, governor.accept(responder, frame));%0A        %7D%0A        assertFalse(%2211th request is refused%22, governor.accept(responder, frame));%0A%0A        Thread.sleep(100);%0A        assertTrue(%22After some time, requests are accepted again%22, governor.accept(responder, frame));%0A    %7D%0A%0A    @Test(timeout = 1000_000L)%0A    public void testLeaseFairness() throws InterruptedException %7B%0A        FairLeaseGovernor governor = new FairLeaseGovernor(4, 1000, TimeUnit.MILLISECONDS);%0A        Responder responder1 = mock(Responder.class);%0A        Responder responder2 = mock(Responder.class);%0A        Frame frame = mock(Frame.class);%0A%0A        governor.register(responder1);%0A        governor.register(responder2);%0A        Thread.sleep(10);%0A%0A        assertTrue(%22First request is accepted on responder 1%22, governor.accept(responder1, frame));%0A        assertTrue(%22First request is accepted on responder 2%22, governor.accept(responder2, frame));%0A        assertTrue(%22Second request is accepted on responder 1%22, governor.accept(responder1, frame));%0A        assertFalse(%22Third request is refused on responder 1%22, governor.accept(responder1, frame));%0A        assertTrue(%22Second request is accepted on responder 2%22, governor.accept(responder2, frame));%0A    %7D%0A%7D%0A

Add unit-test for FairLeaseGovernor (#149)