test/jdk/sun/security/ssl/X509TrustManagerImpl/SelfIssuedCert.java
changeset 50768 68fa3d4026ea
parent 47216 71c04702a3d5
equal deleted inserted replaced
50767:356eaea05bf0 50768:68fa3d4026ea
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 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.
   207         SSLContext context = getSSLContext(trusedCertStr, null, null);
   207         SSLContext context = getSSLContext(trusedCertStr, null, null);
   208         SSLSocketFactory sslsf = context.getSocketFactory();
   208         SSLSocketFactory sslsf = context.getSocketFactory();
   209 
   209 
   210         SSLSocket sslSocket =
   210         SSLSocket sslSocket =
   211             (SSLSocket)sslsf.createSocket("localhost", serverPort);
   211             (SSLSocket)sslsf.createSocket("localhost", serverPort);
       
   212         sslSocket.setEnabledProtocols(new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" });
   212 
   213 
   213         InputStream sslIS = sslSocket.getInputStream();
   214         InputStream sslIS = sslSocket.getInputStream();
   214         OutputStream sslOS = sslSocket.getOutputStream();
   215         OutputStream sslOS = sslSocket.getOutputStream();
   215 
   216 
   216         sslOS.write(280);
   217         sslOS.write(280);