test/jdk/sun/security/pkcs11/sslecc/JSSEClient.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 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.
    65                         "Ignore in client side.");
    65                         "Ignore in client side.");
    66                 return;
    66                 return;
    67             }
    67             }
    68 
    68 
    69             socket.setSoTimeout(CipherTest.TIMEOUT);
    69             socket.setSoTimeout(CipherTest.TIMEOUT);
    70             socket.setEnabledCipherSuites(new String[] {params.cipherSuite});
    70             socket.setEnabledCipherSuites(new String[] {params.cipherSuite.name()});
    71             socket.setEnabledProtocols(new String[] {params.protocol});
    71             socket.setEnabledProtocols(new String[] {params.protocol.name});
    72             InputStream in = socket.getInputStream();
    72             InputStream in = socket.getInputStream();
    73             OutputStream out = socket.getOutputStream();
    73             OutputStream out = socket.getOutputStream();
    74             sendRequest(in, out);
    74             sendRequest(in, out);
    75             socket.close();
    75             socket.close();
    76             SSLSession session = socket.getSession();
    76             SSLSession session = socket.getSession();
    77             session.invalidate();
    77             session.invalidate();
    78             String cipherSuite = session.getCipherSuite();
    78             String cipherSuite = session.getCipherSuite();
    79             if (params.cipherSuite.equals(cipherSuite) == false) {
    79             if (!params.cipherSuite.name().equals(cipherSuite)) {
    80                 throw new Exception("Negotiated ciphersuite mismatch: " + cipherSuite + " != " + params.cipherSuite);
    80                 throw new Exception("Negotiated ciphersuite mismatch: " + cipherSuite + " != " + params.cipherSuite);
    81             }
    81             }
    82             String protocol = session.getProtocol();
    82             String protocol = session.getProtocol();
    83             if (params.protocol.equals(protocol) == false) {
    83             if (!params.protocol.name.equals(protocol)) {
    84                 throw new Exception("Negotiated protocol mismatch: " + protocol + " != " + params.protocol);
    84                 throw new Exception("Negotiated protocol mismatch: " + protocol + " != " + params.protocol);
    85             }
    85             }
    86             if (cipherSuite.indexOf("DH_anon") == -1) {
    86             if (cipherSuite.indexOf("DH_anon") == -1) {
    87                 session.getPeerCertificates();
    87                 session.getPeerCertificates();
    88             }
    88             }