assertEquals(0, s.availablePermits());
}
@Test
public void testAcquire() throws Exception {
ISemaphore s = getInstance().getSemaphore(name);
assertTrue(s.init(10));
getClient().send(new AcquireRequest(name, 3, 0));
boolean result = (Boolean) getClient().receive();
assertTrue(result);
assertEquals(7, s.availablePermits());
getClient().send(new AcquireRequest(name, 8, 6 * 1000));
assertEquals(7, s.availablePermits());
Thread.sleep(2 * 1000);
s.release(1);
result = (Boolean) getClient().receive();
assertTrue(result);
assertEquals(0, s.availablePermits());
getClient().send(new AcquireRequest(name, 4, 2 * 1000));
result = (Boolean) getClient().receive();
assertFalse(result);