--- old/test/jdk/sun/security/ssl/SSLEngineImpl/EngineEnforceUseClientMode.java 2018-05-11 15:08:16.776482200 -0700 +++ new/test/jdk/sun/security/ssl/SSLEngineImpl/EngineEnforceUseClientMode.java 2018-05-11 15:08:16.297195000 -0700 @@ -107,10 +107,9 @@ "wrap(): Didn't catch the exception properly"); } catch (IllegalStateException e) { System.out.println("Caught the correct exception."); - ssle3.wrap(appOut1, oneToTwo); oneToTwo.flip(); if (oneToTwo.hasRemaining()) { - throw new Exception("wrap1 generated data"); + throw new Exception("wrap generated data"); } oneToTwo.clear(); } @@ -122,12 +121,11 @@ "unwrap(): Didn't catch the exception properly"); } catch (IllegalStateException e) { System.out.println("Caught the correct exception."); - ssle4.wrap(appOut1, oneToTwo); - oneToTwo.flip(); - if (oneToTwo.hasRemaining()) { - throw new Exception("wrap2 generated data"); + appIn1.flip(); + if (appIn1.hasRemaining()) { + throw new Exception("unwrap generated data"); } - oneToTwo.clear(); + appIn1.clear(); } try { @@ -137,12 +135,6 @@ "unwrap(): Didn't catch the exception properly"); } catch (IllegalStateException e) { System.out.println("Caught the correct exception."); - ssle5.wrap(appOut1, oneToTwo); - oneToTwo.flip(); - if (oneToTwo.hasRemaining()) { - throw new Exception("wrap3 generated data"); - } - oneToTwo.clear(); } boolean dataDone = false; @@ -200,7 +192,7 @@ System.out.println("Try changing modes..."); try { - ssle2.setUseClientMode(false); + ssle2.setUseClientMode(true); throw new RuntimeException( "setUseClientMode(): " + "Didn't catch the exception properly"); @@ -311,8 +303,10 @@ log("Data transferred cleanly"); } - a.clear(); - b.clear(); + a.position(a.limit()); + b.position(b.limit()); + a.limit(a.capacity()); + b.limit(b.capacity()); } private static void log(String str) {