@Test
public void checkWriteWithCallback() throws IOException {

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
    JSONObject resp = new JSONObject();
    resp.put("value", "hello");
    String respString = "callbackFunc(" + resp.toJSONString() + ");";
    IoUtil.streamResponseAndClose(writer,resp,"callbackFunc");
    assertEquals(out.size(), respString.length());
    assertEquals(out.toString("UTF-8"), respString);
    assertWriterClosed(writer);
}