BindRequestReceiver { void notifyAcceptBind(Bind bindParameter) throws IllegalStateException { lock.lock(); try { if (request == null) { request = new BindRequest(bindParameter, responseHandler); requestCondition.signal(); } else { throw new IllegalStateException("Already waiting for acceptance bind"); } } finally { lock.unlock(); } } BindRequestReceiver(ServerResponseHandler responseHandler);   }
@Test(groups="checkintest") public void testNoSingleAccept() { try { requestReceiver.notifyAcceptBind(dummyBind()); } catch (IllegalStateException e) { fail("Should not fail waitForRequest and success accepting request"); } try { requestReceiver.notifyAcceptBind(dummyBind()); fail("Should throw IllegalStateException"); } catch (IllegalStateException e) { } }