/**
   * Creates a new NetarkivetMessage.
   *
   * @param to the initial receiver of the message
   * @param replyTo the initial sender of the message
   * @throws ArgumentNotValid if to==replyTo, the replyTo parameter is a topic instead of a queue,
   *     or there is a null parameter.
   */
  protected NetarkivetMessage(ChannelID to, ChannelID replyTo) {
    ArgumentNotValid.checkNotNull(to, "to");
    ArgumentNotValid.checkNotNull(replyTo, "replyTo");

    if (to.getName().equals(replyTo.getName())) {
      throw new ArgumentNotValid("to and replyTo should not be equal.");
    }

    // Have not implemented replying to a topic because there is no use
    // for it in our current architecture
    if (Channels.isTopic(replyTo.getName())) {
      throw new ArgumentNotValid(
          "Reply channel must be queue but " + replyTo.toString() + " is a Topic");
    }

    this.to = to;
    this.replyTo = replyTo;
    this.id = null;
    this.replyOfId = null;
  }