--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java Fri Jun 08 16:51:30 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java Fri Jun 08 19:43:11 2018 -0700
@@ -62,12 +62,16 @@
@Override
int bytesInCompletePacket() throws IOException {
-
if (!hasHeader) {
// read exactly one record
- int really = read(is, temporary, 0, headerSize);
- if (really < 0) {
- // EOF: peer shut down incorrectly
+ try {
+ int really = read(is, temporary, 0, headerSize);
+ if (really < 0) {
+ // EOF: peer shut down incorrectly
+ return -1;
+ }
+ } catch (EOFException eofe) {
+ // The caller will handle EOF.
return -1;
}
hasHeader = true;