test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java

Print this page


   1 /*
   2  * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 162             twoToOne.compact();
 163 
 164             /*
 165              * If we've transfered all the data between app1 and app2,
 166              * we try to close and see what that gets us.
 167              */
 168             if (!dataDone && (appOut1.limit() == appIn2.position()) &&
 169                     (appOut2.limit() == appIn1.position())) {
 170 
 171                 checkTransfer(appOut1, appIn2);
 172                 checkTransfer(appOut2, appIn1);
 173 
 174                 log("Closing ssle1's *OUTBOUND*...");
 175                 ssle1.closeOutbound();
 176                 dataDone = true;
 177             }
 178         }
 179     }
 180 
 181     public static void main(String args[]) throws Exception {



 182 
 183         LargeBufs test;
 184 
 185         test = new LargeBufs();
 186         test.runTest("SSL_RSA_WITH_RC4_128_MD5");
 187 
 188         test = new LargeBufs();
 189         test.runTest("SSL_RSA_WITH_3DES_EDE_CBC_SHA");
 190 
 191         System.out.println("Test Passed.");
 192     }
 193 
 194     /*
 195      * **********************************************************
 196      * Majority of the test case is above, below is just setup stuff
 197      * **********************************************************
 198      */
 199 
 200     public LargeBufs() throws Exception {
 201         sslc = getSSLContext(keyFilename, trustFilename);


   1 /*
   2  * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 162             twoToOne.compact();
 163 
 164             /*
 165              * If we've transfered all the data between app1 and app2,
 166              * we try to close and see what that gets us.
 167              */
 168             if (!dataDone && (appOut1.limit() == appIn2.position()) &&
 169                     (appOut2.limit() == appIn1.position())) {
 170 
 171                 checkTransfer(appOut1, appIn2);
 172                 checkTransfer(appOut2, appIn1);
 173 
 174                 log("Closing ssle1's *OUTBOUND*...");
 175                 ssle1.closeOutbound();
 176                 dataDone = true;
 177             }
 178         }
 179     }
 180 
 181     public static void main(String args[]) throws Exception {
 182         // reset the security property to make sure that the algorithms
 183         // and keys used in this test are not disabled.
 184         Security.setProperty("jdk.tls.disabledAlgorithms", "");
 185 
 186         LargeBufs test;
 187 
 188         test = new LargeBufs();
 189         test.runTest("SSL_RSA_WITH_RC4_128_MD5");
 190 
 191         test = new LargeBufs();
 192         test.runTest("SSL_RSA_WITH_3DES_EDE_CBC_SHA");
 193 
 194         System.out.println("Test Passed.");
 195     }
 196 
 197     /*
 198      * **********************************************************
 199      * Majority of the test case is above, below is just setup stuff
 200      * **********************************************************
 201      */
 202 
 203     public LargeBufs() throws Exception {
 204         sslc = getSSLContext(keyFilename, trustFilename);