public void testGETWithSmallResponseContentChunked() throws Exception
{
final String pangram1 = "the quick brown fox jumps over the lazy dog";
final String pangram2 = "qualche vago ione tipo zolfo, bromo, sodio";
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.setHeader("Transfer-Encoding", "chunked");
ServletOutputStream output = httpResponse.getOutputStream();
output.write(pangram1.getBytes(StandardCharsets.UTF_8));
httpResponse.setHeader("EXTRA", "X");
output.flush();
output.write(pangram2.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(2);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
private final AtomicInteger replyFrames = new AtomicInteger();
private final AtomicInteger dataFrames = new AtomicInteger();
@Override