# HG changeset patch # User xuelei # Date 1387167885 28800 # Node ID 7980346542b6bde6349f48e3750f14e7c3ec9f83 # Parent b7163958d6d99f68390739e76ec9ede199620254 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 diff -r b7163958d6d9 -r 7980346542b6 jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java --- 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++) {