8049314: javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java fails intermittently with "Unexpected EOF" message
Reviewed-by: xuelei
--- a/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Tue Jun 21 00:45:52 2016 +0100
+++ b/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Mon Jun 20 17:06:27 2016 -0700
@@ -178,8 +178,11 @@
char[] passphrase = "passphrase".toCharArray();
- ks.load(new FileInputStream(keyFilename), passphrase);
- ts.load(new FileInputStream(trustFilename), passphrase);
+ try (FileInputStream keyFile = new FileInputStream(keyFilename);
+ FileInputStream trustFile = new FileInputStream(trustFilename)) {
+ ks.load(keyFile, passphrase);
+ ts.load(trustFile, passphrase);
+ }
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, passphrase);
@@ -310,6 +313,7 @@
if (retry &&
serverIn.remaining() < clientMsg.length) {
log("Need to read more from client");
+ serverIn.compact();
retry = false;
continue;
} else {