@Test
public void testCallbackPost() throws URISyntaxException, IOException, java.text.ParseException {

    HttpExchange exchange = prepareExchange("http://localhost:8080/jolokia?callback=data",
                                            "Content-Type","text/plain; charset=UTF-8",
                                            "Origin",""
                                           );
    prepareMemoryPostReadRequest(exchange);
    Headers header = new Headers();
    ByteArrayOutputStream out = prepareResponse(handler, exchange, header);
    handler.doHandle(exchange);
    assertEquals(header.getFirst("content-type"),"text/javascript; charset=utf-8");
    String result = out.toString("utf-8");
    assertTrue(result.endsWith("});"));
    assertTrue(result.startsWith("data({"));
    assertTrue(result.contains("\"used\""));
    assertEquals(header.getFirst("Cache-Control"),"no-cache");
    assertEquals(header.getFirst("Pragma"),"no-cache");
    SimpleDateFormat rfc1123Format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
    rfc1123Format.setTimeZone(TimeZone.getTimeZone("GMT"));
    String expires = header.getFirst("Expires");
    String date = header.getFirst("Date");
    Date parsedExpires = rfc1123Format.parse(expires);
    Date parsedDate = rfc1123Format.parse(date);
    assertTrue(parsedExpires.before(parsedDate) || parsedExpires.equals(parsedDate));
    Date now = new Date();
    assertTrue(parsedExpires.before(now) || parsedExpires.equals(now));
}