public boolean offer(Serializable event) {
    if (queue == null) {
      throw new IllegalStateException("client has no event queue");
    }
    return queue.offer(event);
  }
@Test
  public void testOfferEventAndRun() throws Exception {
    client.offer(TEST_EVENT);

    Thread thread = new Thread(client);
    thread.start();

    // MockEventQueue will interrupt the thread when the queue is drained
    thread.join(1000);
    assertFalse(thread.isAlive());

    ObjectInputStream ois = new ObjectInputStream(
        new ByteArrayInputStream(outputStream.toByteArray()));
    assertEquals(TEST_EVENT, ois.readObject());
  }