private void handleAllocationRequest() throws StunException, IOException, InterruptedException { StunMessageEvent event = eventsReceivedByTurnServer.poll(5, TimeUnit.SECONDS); TransportAddress localAddress = event.getLocalAddress(); TransportAddress remoteAddress = event.getRemoteAddress(); Request request = (Request) event.getMessage(); assertThat(request.getMessageType(), is(Message.ALLOCATE_REQUEST)); Response allocationResponse = MessageFactory.createAllocationResponse( request, remoteAddress, new TransportAddress(localAddress.getHostAddress(), 2222, UDP), 100); sendResponse(remoteAddress, request, allocationResponse); }