public void testGETWithResponseResetBuffer() throws Exception
{
final String data1 = "0123456789ABCDEF";
final String data2 = "FEDCBA9876543210";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
throws IOException, ServletException
{
request.setHandled(true);
httpResponse.setStatus(HttpServletResponse.SC_OK);
ServletOutputStream output = httpResponse.getOutputStream();
// Write some
output.write(data1.getBytes(StandardCharsets.UTF_8));
// But then change your mind and reset the buffer
httpResponse.resetBuffer();
output.write(data2.getBytes(StandardCharsets.UTF_8));
handlerLatch.countDown();
}
}, 30000), null);
Fields headers = SPDYTestUtils.createHeaders("localhost", connector.getPort(), version, "GET", "/foo");
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@Override
public void onReply(Stream stream, ReplyInfo replyInfo)