BindRequest { public void reject(int errorCode) throws IllegalStateException, IOException { lock.lock(); try { if (done) { throw new IllegalStateException("Response already initiated"); } else { done = true; try { responseHandler.sendNegativeResponse(bindType.commandId(), errorCode, originalSequenceNumber); } finally { condition.signal(); } } } finally { lock.unlock(); } } BindRequest(int sequenceNumber, BindType bindType, String systemId, String password, 
            String systemType, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, 
            String addressRange, InterfaceVersion interfaceVersion, ServerResponseHandler responseHandler);  BindRequest(Bind bind, ServerResponseHandler responseHandler); @Deprecated BindParameter getBindParameter(); BindType getBindType(); String getSystemId(); String getPassword(); String getSystemType(); TypeOfNumber getAddrTon(); NumberingPlanIndicator getAddrNpi(); String getAddressRange(); InterfaceVersion getInterfaceVersion(); void accept(String systemId); void accept(String systemId, InterfaceVersion interfaceVersion); void reject(int errorCode);  }
@Test(groups="checkintest") public void testSucceedReject() { try { bindRequest.reject(-1); } catch (IllegalStateException e1) { fail("Should succes rejecting bind request"); } catch (IOException e1) { fail("Should succes rejecting bind request"); } }
@Test(groups="checkintest") public void testFailedReject() { responseHandler.closeConnection(); try { bindRequest.reject(-1); fail("Should throw IOException"); } catch (IllegalStateException e) { fail("Should throw IOException"); } catch (IOException e) { } }
@Test(groups="checkintest") public void testNonSingleReject() { try { bindRequest.reject(-1); } catch (IllegalStateException e1) { fail("Should success rejecting bind request"); } catch (IOException e1) { fail("Should success rejecting bind request"); } try { bindRequest.reject(-1); fail("Should fail on 2nd reject"); } catch (IllegalStateException e) { } catch (IOException e) { fail("Should throw IllegalStateException"); } }