};
Session session = startClient(startServer(serverSessionFrameListener), clientSessionFrameListener);
// First stream is processed ok
final CountDownLatch reply1Latch = new CountDownLatch(1);
session.syn(new SynInfo(5, TimeUnit.SECONDS, new Fields(), true, (byte)0), new StreamFrameListener.Adapter()
{
@Override
public void onReply(Stream stream, ReplyInfo replyInfo)
{
reply1Latch.countDown();
}
});
Assert.assertTrue(reply1Latch.await(5, TimeUnit.SECONDS));
// Second stream is closed in the middle
Stream stream2 = session.syn(new SynInfo(5, TimeUnit.SECONDS, new Fields(), false, (byte)0), null);
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
// There is a race between the data we want to send, and the client
// closing the connection because the server closed it after the
// go_away, so we guard with a try/catch to have the test pass cleanly