@Override public void messageArrived(TransMsgEvent receivingEvent) { Message msg = receivingEvent.getPayload(); if (msg instanceof SeqMessage) { SeqMessage resp = (SeqMessage) msg; if (resp.getSeqNumber() == seqNr) { if (gotResponse(resp)) { new StopListening().scheduleAtTime(0); // TODO: // Workaround } } } }
@Override protected void execute() { TransLayer trans = component.getHost().getTransLayer(); if (listener != null) trans.removeTransMsgListener(listener, component.getPort()); seqNr = getNewSequenceNumber(); SeqMessage request = createReqMessage(); request.setSeqNumber(seqNr); trans.send(request, to.getTransInfo(), to.getTransInfo().getPort(), TransProtocol.UDP); trans.addTransMsgListener(listener = this.new Listener(), component.getPort()); timeout = this.new Timeout(); timeout.scheduleWithDelay(getTimeout()); }