Waiting for all the frames to arrive before stopping.

This commit is contained in:
Simone Bordet 2014-08-08 01:11:11 +02:00
parent 466d8db8d8
commit 6b9a069d9d

View File

@ -29,7 +29,9 @@ import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.http2.api.Stream;
import org.eclipse.jetty.http2.api.server.ServerSessionListener;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FuturePromise;
import org.eclipse.jetty.util.Jetty;
import org.eclipse.jetty.util.Promise;
@ -60,7 +62,16 @@ public class Client
public void onHeaders(Stream stream, HeadersFrame frame)
{
System.err.println(frame.getMetaData());
latch.countDown();
if (frame.isEndStream())
latch.countDown();
}
@Override
public void onData(Stream stream, DataFrame frame, Callback callback)
{
callback.succeeded();
if (frame.isEndStream())
latch.countDown();
}
});