String node = MessageUtils.getToAgentNode (msg); MessageTimes times[] = getLatestMessageReceptions (node);
    public MessageAttributes forwardMessage (AttributedMessage msg)       throws UnregisteredNameException, NameLookupException,              CommFailureException, MisdeliveredMessageException    {      //  Set a send time for the message.  Kind of a hack, but need BBN       //  support to have link protocols set the send time at the time a       //  message is actually sent.      long sendTime = now();      MessageUtils.setMessageSendTime (msg, sendTime);            //  Get a candidate set of times from our stored data about the      //  destination node - these are the latest inbound times of      //  messages from the destination node, that, in concert with      //  information from this message being sent, the destination      //  node will be able to calculate RTTs for a set of currently      //  active protocol links.      int MAX_RTTS = 5;  // HACK: arbitrary for now      String node = MessageUtils.getToAgentNode (msg);      MessageTimes times[] = getLatestMessageReceptions (node);      Vector v = null;      if (times.length > 0)      {        v = new Vector();        Arrays.sort (times, timeSort);  // latest receives first        for (int i=0; i<MAX_RTTS && i<times.length; i++)         {          RTTStart start = new RTTStart();          start.setSendLink (times[i].sendLink);          long nodeTime = sendTime - times[i].receiveTime;  // time msg spent here          start.setAdjustedSendTime (times[i].sendTime + nodeTime);          v.add (start);        }      }//inject bug to test link delivery //v = new Vector();//v.add (new String ("a bug"));      msg.setAttribute (RTT_ATTRIBUTE, v);      //  Send the message on its way      return link.forwardMessage (msg);    }