test/jdk/sun/security/ssl/AppOutputStream/NoExceptionOnClose.java
branchJDK-8145252-TLS13-branch
changeset 56579 fb93f16d20fa
parent 47216 71c04702a3d5
child 56750 2b4ae319412b
equal deleted inserted replaced
56575:c31233a71bd9 56579:fb93f16d20fa
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   150          */
   150          */
   151         boolean isSocketClosedThrown = false;
   151         boolean isSocketClosedThrown = false;
   152         try {
   152         try {
   153             sslOS.write(22);
   153             sslOS.write(22);
   154             sslOS.flush();
   154             sslOS.flush();
   155         } catch (SocketException socketClosed) {
   155         } catch (SSLException socketClosed) {
   156                 System.out.println("Received \"" + socketClosed.getMessage()
   156                 System.out.println("Received \"" + socketClosed.getMessage()
   157                         + "\" exception as expected");
   157                         + "\" exception as expected");
   158                 isSocketClosedThrown = true;
   158                 isSocketClosedThrown = true;
   159           }
   159         }
   160         if (!isSocketClosedThrown) {
   160         if (!isSocketClosedThrown) {
   161                 throw new Exception("No Exception thrown on write() after"
   161                 throw new Exception("No Exception thrown on write() after"
   162                                 + " close()");
   162                                 + " close()");
   163         }
   163         }
   164     }
   164     }