test/jdk/sun/security/ssl/SSLEngineImpl/EngineEnforceUseClientMode.java
changeset 50768 68fa3d4026ea
parent 47216 71c04702a3d5
child 51141 2dd2d73c52f6
--- a/test/jdk/sun/security/ssl/SSLEngineImpl/EngineEnforceUseClientMode.java	Mon Jun 25 21:22:16 2018 +0300
+++ b/test/jdk/sun/security/ssl/SSLEngineImpl/EngineEnforceUseClientMode.java	Mon Jun 25 13:41:39 2018 -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) {