jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
changeset 39317 fbda4d400372
parent 37309 8f530b9d18f4
child 40390 64541737c7f7
equal deleted inserted replaced
39316:3042646f9b7b 39317:fbda4d400372
   508 
   508 
   509         SSLContext sslc = SSLContext.getInstance("TLS");
   509         SSLContext sslc = SSLContext.getInstance("TLS");
   510         sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
   510         sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
   511 
   511 
   512         SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
   512         SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
   513         SSLServerSocket sslServerSocket =
   513 
   514             (SSLServerSocket) sslssf.createServerSocket(serverPort);
   514         try (SSLServerSocket sslServerSocket =
   515 
   515                 (SSLServerSocket) sslssf.createServerSocket(serverPort)) {
   516         serverPort = sslServerSocket.getLocalPort();
   516 
   517 
   517             serverPort = sslServerSocket.getLocalPort();
   518         /*
   518 
   519          * Signal Client, we're ready for his connect.
   519             /*
   520          */
   520              * Signal Client, we're ready for his connect.
   521         serverReady = true;
   521              */
   522 
   522             serverReady = true;
   523         try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
   523 
   524                 InputStream sslIS = sslSocket.getInputStream();
   524             try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
   525                 OutputStream sslOS = sslSocket.getOutputStream()) {
   525                     InputStream sslIS = sslSocket.getInputStream();
   526             int numberIn = sslIS.read();
   526                     OutputStream sslOS = sslSocket.getOutputStream()) {
   527             int numberSent = 85;
   527                 int numberIn = sslIS.read();
   528             log("Server received number: " + numberIn);
   528                 int numberSent = 85;
   529             sslOS.write(numberSent);
   529                 log("Server received number: " + numberIn);
   530             sslOS.flush();
   530                 sslOS.write(numberSent);
   531             log("Server sent number: " + numberSent);
   531                 sslOS.flush();
       
   532                 log("Server sent number: " + numberSent);
       
   533             }
   532         }
   534         }
   533     }
   535     }
   534 
   536 
   535     /*
   537     /*
   536      * Define the client side of the test.
   538      * Define the client side of the test.