@Test
public void testDeserializarion() throws Exception {

  Type listType = new TypeToken<List<JSONEvent>>() {
  }.getType();
  List<JSONEvent> events = Lists.newArrayList();
  Random rand = new Random();
  for (int i = 1; i < 10; i++) {
    Map<String, String> input = Maps.newHashMap();
    for (int j = 1; j < 10; j++) {
      input.put(String.valueOf(i) + String.valueOf(j), String.valueOf(i));
    }
    JSONEvent e = new JSONEvent();
    e.setBody(String.valueOf(rand.nextGaussian()).getBytes("UTF-8"));
    e.setHeaders(input);
    events.add(e);
  }
  Gson gson = new Gson();
  List<Event> deserialized = handler.getEvents(
          new FlumeHttpServletRequestWrapper(gson.toJson(events, listType)));
  int i = 0;
  for (Event e : deserialized) {
    Event current = events.get(i++);
    Assert.assertEquals(new String(current.getBody(),"UTF-8"),
            new String(e.getBody(),"UTF-8"));
    Assert.assertEquals(current.getHeaders(), e.getHeaders());
  }
}