Skip to content

Commit

Permalink
HTTPCORE-771: Ignore java.lang.UnsupportedOperationException when gra…
Browse files Browse the repository at this point in the history
…cefully shutting classic SSL sockets for compatibility with Oracle JDK 1.8
  • Loading branch information
ok2c committed Oct 13, 2024
1 parent 5fb5aa0 commit bf5871c
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,17 @@ public void close(final CloseMode closeMode) {
try {
if (sslSocket != null) {
try {
if (!sslSocket.isOutputShutdown()) {
sslSocket.shutdownOutput();
}
if (!sslSocket.isInputShutdown()) {
sslSocket.shutdownInput();
try {
if (!sslSocket.isOutputShutdown()) {
sslSocket.shutdownOutput();
}
if (!sslSocket.isInputShutdown()) {
sslSocket.shutdownInput();
}
} catch (final UnsupportedOperationException ignore) {
// Some JREs such as Oracle JDK 1.8 do not support
// Socket#shutdownOutput() and Socket#shutdownInput() methods
// "because of the TLS half-close policy"
}
sslSocket.close();
} catch (final IOException ignore) {
Expand Down

0 comments on commit bf5871c

Please sign in to comment.