< prev index next >

test/jdk/sun/security/ssl/SSLSocketImpl/NewSocketMethods.java

Print this page
rev 59107 : imported patch security


 186                 (SSLSocketFactory) SSLSocketFactory.getDefault();
 187             Socket plainSocket = new Socket("localhost", serverPort);
 188             socket = (SSLSocket)
 189                 sslsf.createSocket(plainSocket, "localhost", serverPort, true);
 190         }
 191         else
 192             socket = new Socket("localhost", serverPort);
 193         try {
 194             InputStream is = socket.getInputStream();
 195             OutputStream os = socket.getOutputStream();
 196 
 197             /**
 198              * test some new methods of java.net.Socket added to merlin.
 199              */
 200             System.out.println("Client isInputShutdown() "
 201                         + socket.isInputShutdown());
 202             socket.setReuseAddress(true);
 203             System.out.println("Client getReuseAddress(): "
 204                         + socket.getReuseAddress());
 205 
 206             // Solaris does not support set/get of IPV6_TCLASS when connected
 207             if (!"SunOS".equals(System.getProperty("os.name"))) {
 208                 socket.setTrafficClass(8);
 209                 System.out.println("Client getTrafficClass(): "
 210                         + socket.getTrafficClass());
 211             }
 212 
 213             os.write(237);
 214             os.flush();
 215             System.out.println("Client read: " + is.read());
 216             socket.close();
 217             System.out.println("Client isOutputShutdown() "
 218                         + socket.isOutputShutdown());
 219         } catch (Exception unexpected) {
 220             throw new Exception(" test failed, caught exception: "
 221                         + unexpected);
 222           }
 223     }
 224 
 225     /*
 226      * =============================================================
 227      * The remainder is just support stuff
 228      */
 229 
 230     // use any free port by default
 231     volatile int serverPort = 0;




 186                 (SSLSocketFactory) SSLSocketFactory.getDefault();
 187             Socket plainSocket = new Socket("localhost", serverPort);
 188             socket = (SSLSocket)
 189                 sslsf.createSocket(plainSocket, "localhost", serverPort, true);
 190         }
 191         else
 192             socket = new Socket("localhost", serverPort);
 193         try {
 194             InputStream is = socket.getInputStream();
 195             OutputStream os = socket.getOutputStream();
 196 
 197             /**
 198              * test some new methods of java.net.Socket added to merlin.
 199              */
 200             System.out.println("Client isInputShutdown() "
 201                         + socket.isInputShutdown());
 202             socket.setReuseAddress(true);
 203             System.out.println("Client getReuseAddress(): "
 204                         + socket.getReuseAddress());
 205 


 206             socket.setTrafficClass(8);
 207             System.out.println("Client getTrafficClass(): "
 208                     + socket.getTrafficClass());

 209 
 210             os.write(237);
 211             os.flush();
 212             System.out.println("Client read: " + is.read());
 213             socket.close();
 214             System.out.println("Client isOutputShutdown() "
 215                         + socket.isOutputShutdown());
 216         } catch (Exception unexpected) {
 217             throw new Exception(" test failed, caught exception: "
 218                         + unexpected);
 219           }
 220     }
 221 
 222     /*
 223      * =============================================================
 224      * The remainder is just support stuff
 225      */
 226 
 227     // use any free port by default
 228     volatile int serverPort = 0;


< prev index next >