/** Close events has the cumulative checksum value */
 public Event closeEvent() {
   Event e = new EventImpl(new byte[0]);
   e.set(ATTR_ACK_TYPE, CHECKSUM_STOP);
   e.set(ATTR_ACK_HASH, ByteBuffer.allocate(8).putLong(checksum).array());
   e.set(ATTR_ACK_TAG, tag);
   return e;
 }
  /**
   * Open event starts with a random value that the checksum will be based off of.
   *
   * <p>Use the host and the nanos as a tag at the collector side.
   */
  public Event openEvent() {
    Event e = new EventImpl(new byte[0]);
    e.set(ATTR_ACK_TYPE, CHECKSUM_START);
    checksum = e.getTimestamp();
    e.set(ATTR_ACK_HASH, ByteBuffer.allocate(8).putLong(checksum).array());
    e.set(ATTR_ACK_TAG, tag);

    return e;
  }
  /** Calculate the crc based on the body of the message and xor it into the checksum. */
  public void append(Event e) throws IOException, InterruptedException {
    chk.reset();
    chk.update(e.getBody());
    long curchk = chk.getValue();
    checksum ^= curchk; // update but do not send.

    e.set(ATTR_ACK_TYPE, CHECKSUM_MSG);
    e.set(ATTR_ACK_TAG, tag);
    e.set(ATTR_ACK_HASH, ByteBuffer.allocate(8).putLong(curchk).array());
    super.append(e);
  }
  @Before
  public void setUp() {
    testEvent = new EventImpl();

    testEvent.set("one", "one".getBytes());
    testEvent.set("two", "two".getBytes());
  }