< prev index next >

test/jdk/jdk/net/Sockets/Test.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2014, 2019, 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  */


 172         } catch (UnsupportedOperationException e) {
 173             if (expectSupport) {
 174                 throw new RuntimeException("Test failed: " +
 175                         "unexpected UnsupportedOperationException");
 176             }
 177             out.println("UnsupportedOperationException as expected");
 178             return;
 179         } catch (IOException e) {
 180             // Probably a permission error, but we're not
 181             // going to check unless a specific permission exception
 182             // is defined.
 183             System.out.println(e);
 184         }
 185         if (!expectSupport) {
 186             throw new RuntimeException("Test failed: " +
 187                     "UnsupportedOperationException was not thrown");
 188         }
 189     }
 190 
 191     private static boolean checkExpectedOptionSupport() {
 192         if (Platform.isSolaris()) {
 193             OSVersion solarisVersion = OSVersion.current();
 194             OSVersion solarisVersionToCheck = new OSVersion(11, 2);
 195             if (solarisVersion.compareTo(solarisVersionToCheck) >= 0) {
 196                 System.out.println("This Solaris version (" + solarisVersion
 197                         + ") should support SO_FLOW_SLA option");
 198                 return true;
 199             } else {
 200                 System.out.println("This Solaris version (" + solarisVersion
 201                         + ") should not support SO_FLOW_SLA option");
 202             }
 203         } else {
 204             System.out.println("Not Solaris, SO_FLOW_SLA should not be " +
 205                     "supported");
 206         }
 207         return false;
 208     }
 209 
 210 }
   1 /*
   2  * Copyright (c) 2014, 2020, 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  */


 172         } catch (UnsupportedOperationException e) {
 173             if (expectSupport) {
 174                 throw new RuntimeException("Test failed: " +
 175                         "unexpected UnsupportedOperationException");
 176             }
 177             out.println("UnsupportedOperationException as expected");
 178             return;
 179         } catch (IOException e) {
 180             // Probably a permission error, but we're not
 181             // going to check unless a specific permission exception
 182             // is defined.
 183             System.out.println(e);
 184         }
 185         if (!expectSupport) {
 186             throw new RuntimeException("Test failed: " +
 187                     "UnsupportedOperationException was not thrown");
 188         }
 189     }
 190 
 191     private static boolean checkExpectedOptionSupport() {
 192         System.out.println("SO_FLOW_SLA should not be supported");














 193         return false;
 194     }
 195 
 196 }
< prev index next >