public void testClientRetransmissions() throws Exception {
  String oldRetransValue=System.getProperty(StackProperties.MAX_CTRAN_RETRANSMISSIONS);
  String oldMaxWaitValue=System.getProperty(StackProperties.MAX_CTRAN_RETRANS_TIMER);
  System.setProperty(StackProperties.MAX_CTRAN_RETRANS_TIMER,"100");
  System.setProperty(StackProperties.MAX_CTRAN_RETRANSMISSIONS,"2");
  System.setProperty(StackProperties.PROPAGATE_RECEIVED_RETRANSMISSIONS,"true");
  stunStack.addRequestListener(serverAddress,requestCollector);
  stunStack.sendRequest(bindingRequest,serverAddress,clientAddress,responseCollector);
  Thread.sleep(1000);
  Vector<StunMessageEvent> reqs=requestCollector.getRequestsForTransaction(bindingRequest.getTransactionID());
  assertTrue("No retransmissions of the request have been received",reqs.size() > 1);
  assertTrue("The binding request has been retransmitted more than it " + "should have!",reqs.size() >= 3);
  if (oldRetransValue != null)   System.getProperty(StackProperties.MAX_CTRAN_RETRANSMISSIONS,oldRetransValue);
 else   System.clearProperty(StackProperties.MAX_CTRAN_RETRANSMISSIONS);
  if (oldMaxWaitValue != null)   System.getProperty(StackProperties.MAX_CTRAN_RETRANS_TIMER,oldRetransValue);
 else   System.clearProperty(StackProperties.MAX_CTRAN_RETRANS_TIMER);
}

public void testClientRetransmissions ( ) throws Exception { String oldRetransValue = System . getProperty ( StackProperties . MAX_CTRAN_RETRANSMISSIONS ) ; String oldMaxWaitValue = System . getProperty ( StackProperties . MAX_CTRAN_RETRANS_TIMER ) ; System . setProperty ( StackProperties . MAX_CTRAN_RETRANS_TIMER , "100" ) ; System . setProperty ( StackProperties . MAX_CTRAN_RETRANSMISSIONS , "2" ) ; System . setProperty ( StackProperties . PROPAGATE_RECEIVED_RETRANSMISSIONS , "true" ) ; stunStack . addRequestListener ( serverAddress , requestCollector ) ; stunStack . sendRequest ( bindingRequest , serverAddress , clientAddress , responseCollector ) ; Thread . sleep ( 1000 ) ; Vector < StunMessageEvent > reqs = requestCollector . getRequestsForTransaction ( bindingRequest . getTransactionID ( ) ) ; assertTrue ( "No retransmissions of the request have been received" , reqs . size ( ) > 1 ) ; assertTrue ( "The binding request has been retransmitted more than it " + "should have!" , reqs . size ( ) >= 3 ) ; if ( oldRetransValue != null ) System . getProperty ( StackProperties . MAX_CTRAN_RETRANSMISSIONS , oldRetransValue ) ; else System . clearProperty ( StackProperties . MAX_CTRAN_RETRANSMISSIONS ) ; if ( oldMaxWaitValue != null ) System . getProperty ( StackProperties . MAX_CTRAN_RETRANS_TIMER , oldRetransValue ) ; else System . clearProperty ( StackProperties . MAX_CTRAN_RETRANS_TIMER ) ; }
test that requests are retransmitted if no response is received
