Projects
openEuler:24.03:SP1:Everything
openjdk-1.8.0
_service:tar_scm:8260923-Add-more-tests-for-SSL...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:8260923-Add-more-tests-for-SSLSocket-input-output-sh.patch of Package openjdk-1.8.0
From c3aae68d629a3adc02fb0764c95d922e716f0ee3 Mon Sep 17 00:00:00 2001 From: zhangyipeng <zhangyipeng7@huawei.com> Date: Mon, 15 Jan 2024 11:13:55 +0800 Subject: [PATCH] [Backport]8260923: Add more tests for SSLSocket input/output shutdown --- .../ssl/SSLSocketImpl/SSLSocketCloseHang.java | 69 ++++++++++++++-------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/jdk/test/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java b/jdk/test/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java index f74c1fe76..ff6334feb 100644 --- a/jdk/test/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java +++ b/jdk/test/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java @@ -23,12 +23,17 @@ /* * @test - * @bug 8184328 8253368 + * @bug 8184328 8253368 8260923 * @summary JDK8u131-b34-socketRead0 hang at SSL read - * @run main/othervm SSLSocketCloseHang - * @run main/othervm SSLSocketCloseHang shutdownInputTest + * @run main/othervm SSLSocketCloseHang TLSv1.2 + * @run main/othervm SSLSocketCloseHang TLSv1.2 shutdownInput + * @run main/othervm SSLSocketCloseHang TLSv1.2 shutdownOutput + * @run main/othervm SSLSocketCloseHang TLSv1.3 + * @run main/othervm SSLSocketCloseHang TLSv1.3 shutdownInput + * @run main/othervm SSLSocketCloseHang TLSv1.3 shutdownOutput */ + import java.io.*; import java.net.*; import java.util.*; @@ -36,7 +41,6 @@ import java.security.*; import javax.net.ssl.*; public class SSLSocketCloseHang { - /* * ============================================================= * Set the various variables needed for the tests, then @@ -73,7 +77,7 @@ public class SSLSocketCloseHang { */ static boolean debug = false; - static boolean shutdownInputTest = false; + static String socketCloseType; /* * If the client or server is doing some kind of object creation @@ -148,28 +152,45 @@ public class SSLSocketCloseHang { Thread.sleep(500); System.err.println("Client closing: " + System.nanoTime()); - if (shutdownInputTest) { - try { - sslSocket.shutdownInput(); - } catch (SSLException e) { - if (!e.getMessage().contains - ("closing inbound before receiving peer's close_notify")) { - throw new RuntimeException("expected different exception message. " + - e.getMessage()); - } - } - if (!sslSocket.getSession().isValid()) { - throw new RuntimeException("expected session to remain valid"); - } + closeConnection(sslSocket); + + clientClosed = true; + System.err.println("Client closed: " + System.nanoTime()); + } + private void closeConnection(SSLSocket sslSocket) throws IOException { + if ("shutdownInput".equals(socketCloseType)) { + shutdownInput(sslSocket); + // second call to shutdownInput() should just return, + // shouldn't throw any exception + sslSocket.shutdownInput(); + // invoking shutdownOutput() just after shutdownInput() + sslSocket.shutdownOutput(); + } else if ("shutdownOutput".equals(socketCloseType)) { + sslSocket.shutdownOutput(); + // second call to shutdownInput() should just return, + // shouldn't throw any exception + sslSocket.shutdownOutput(); + // invoking shutdownInput() just after shutdownOutput() + shutdownInput(sslSocket); } else { sslSocket.close(); } + } - - - clientClosed = true; - System.err.println("Client closed: " + System.nanoTime()); + private void shutdownInput(SSLSocket sslSocket) throws IOException { + try { + sslSocket.shutdownInput(); + } catch (SSLException e) { + if (!e.getMessage().contains + ("closing inbound before receiving peer's close_notify")) { + throw new RuntimeException("expected different exception " + + "message. " + e.getMessage()); + } + } + if (!sslSocket.getSession().isValid()) { + throw new RuntimeException("expected session to remain valid"); + } } /* @@ -197,11 +218,13 @@ public class SSLSocketCloseHang { System.setProperty("javax.net.ssl.keyStorePassword", passwd); System.setProperty("javax.net.ssl.trustStore", trustFilename); System.setProperty("javax.net.ssl.trustStorePassword", passwd); + System.setProperty("jdk.tls.client.protocols", args[0]); if (debug) System.setProperty("javax.net.debug", "all"); - shutdownInputTest = args.length > 0 ? true : false; + socketCloseType = args.length > 1 ? args[1] : ""; + /* * Start the tests. -- 2.12.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2