/**
   * Sends a message to a Distant Kernel.
   *
   * @param message message to send.
   */
  private void sendDistantMessage(KernelMessage message) {
    Message orig;
    if (message instanceof KernelMessage) {
      KernelMessage temp = (KernelMessage) message;
      orig = (Message) (temp.getArgument());
    } else orig = message;

    if (shouldUseUDP(orig)) {
      println("WARN:  No udp message routing yet!!!");
    } else {
      DistantKernelInformation info = getP2PAddress(orig);
      if (info != null) {
        AgentAddress p2p = info.getP2PAgent();
        sendMessage(p2p, new NetworkMessage(NetworkMessage.DISTANT_MESSAGE, orig));
      } else {
        println("WARN : unknown destination kernel" + orig.getReceiver().getKernel());
      }
    }
  }
 private DistantKernelInformation getP2PAddress(Message orig) {
   DistantKernelInformation info =
       (DistantKernelInformation) routeTable.get(orig.getReceiver().getKernel().getID());
   return info;
 }