8028562: Test SSLSocketSSLEngineTemplate.java intermittent failed with "Data length error"
Summary: test stabilization, read one more time in case of message fragment
Reviewed-by: mullan, xuelei
Contributed-by: Zaiyao Liu <zaiyao.liu@oracle.com>
--- a/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java Sun Dec 15 08:11:41 2013 +0000
+++ b/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java Sun Dec 15 20:24:45 2013 -0800
@@ -221,6 +221,9 @@
try {
boolean closed = false;
+ // will try to read one more time in case client message
+ // is fragmented to multiple pieces
+ boolean retry = true;
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
@@ -295,8 +298,14 @@
/*
* A sanity check to ensure we got what was sent.
*/
- if (serverIn.remaining() != clientMsg.length) {
- throw new Exception("Client: Data length error");
+ if (serverIn.remaining() != clientMsg.length) {
+ if (retry && serverIn.remaining() < clientMsg.length) {
+ log("Need to read more from client");
+ retry = false;
+ continue;
+ } else {
+ throw new Exception("Client: Data length error");
+ }
}
for (int i = 0; i < clientMsg.length; i++) {