@Test public void verifyReuseJsonGenerator() throws Exception {
FastCharArrayWriter writer = new FastCharArrayWriter();
XContentGenerator generator = XContentFactory.xContent(XContentType.JSON).createGenerator(writer);
generator.writeStartObject();
generator.writeStringField("test", "value");
generator.writeEndObject();
generator.flush();
assertThat(writer.toStringTrim(), equalTo("{\"test\":\"value\"}"));
// try again...