Made tests more stable.

Naked writes could throw WritePendingException.
Now we wait until the client has finished sending the reply to the
server SETTINGS frame, then we do the naked write.
This commit is contained in:
Simone Bordet 2015-02-27 12:30:42 +01:00
parent ec2fcb6648
commit b533aa6ce5
1 changed files with 9 additions and 2 deletions

View File

@ -730,6 +730,13 @@ public abstract class FlowControlStrategyTest
});
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
// The following "sneaky" write may clash with the write
// of the reply SETTINGS frame sent by the client in
// response to the server SETTINGS frame.
// It is not enough to use a latch on the server to
// wait for the reply frame, since the client may have
// sent the bytes, but not yet be ready to write again.
Thread.sleep(1000);
// Now the client is supposed to not send more frames.
// If it does, the connection must be closed.
@ -788,8 +795,8 @@ public abstract class FlowControlStrategyTest
});
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
// Wait for a while to allow flow control window frames
// to be exchanged before doing the "sneaky" write below.
// Wait for a while before doing the "sneaky" write
// below, see comments in the previous test case.
Thread.sleep(1000);
// Now the client is supposed to not send more frames.