public void testReceiveResponse() throws Exception {
  SimpleResponseCollector collector=new SimpleResponseCollector();
  Request bindingRequest=MessageFactory.createBindingRequest();
  stunStack.sendRequest(bindingRequest,dummyServerAddress,localAddress,collector);
  collector.waitForResponse();
  byte response[]=new byte[msgFixture.bindingResponse.length];
  System.arraycopy(msgFixture.bindingResponse,0,response,0,response.length);
  System.arraycopy(bindingRequest.getTransactionID(),0,response,8,12);
  dummyServerSocket.send(new DatagramPacket(response,response.length,localAddress));
  collector.waitForResponse();
  Response collectedResponse=collector.collectedResponse;
  byte expectedReturn[]=response;
  byte actualReturn[]=collectedResponse.encode(stunStack);
  assertTrue("Received request was not the same as the one that was sent",Arrays.equals(expectedReturn,actualReturn));
}

public void testReceiveResponse ( ) throws Exception { SimpleResponseCollector collector = new SimpleResponseCollector ( ) ; Request bindingRequest = MessageFactory . createBindingRequest ( ) ; stunStack . sendRequest ( bindingRequest , dummyServerAddress , localAddress , collector ) ; collector . waitForResponse ( ) ; byte response [ ] = new byte [ msgFixture . bindingResponse . length ] ; System . arraycopy ( msgFixture . bindingResponse , 0 , response , 0 , response . length ) ; System . arraycopy ( bindingRequest . getTransactionID ( ) , 0 , response , 8 , 12 ) ; dummyServerSocket . send ( new DatagramPacket ( response , response . length , localAddress ) ) ; collector . waitForResponse ( ) ; Response collectedResponse = collector . collectedResponse ; byte expectedReturn [ ] = response ; byte actualReturn [ ] = collectedResponse . encode ( stunStack ) ; assertTrue ( "Received request was not the same as the one that was sent" , Arrays . equals ( expectedReturn , actualReturn ) ) ; }
performs a basic test on message reception
