code: public static boolean isExpected(Throwable cause) {
          if (Flags.verboseSocketExceptions()) {
              return false;
          }
  
          // We do not need to log every exception because some exceptions are expected to occur.
  
          if (cause instanceof ClosedChannelException || cause instanceof ClosedSessionException) {
              // Can happen when attempting to write to a channel closed by the other end.
              return true;
          }
  
          final String msg = cause.getMessage();
          if (msg != null) {
              if ((cause instanceof IOException || cause instanceof ChannelException) &&
                  IGNORABLE_SOCKET_ERROR_MESSAGE.matcher(msg).find()) {
                  // Can happen when socket error occurs.
                  return true;
              }
  
              if (cause instanceof Http2Exception && IGNORABLE_HTTP2_ERROR_MESSAGE.matcher(msg).find()) {
                  // Can happen when disconnected prematurely.
                  return true;
              }
  
              if (cause instanceof SSLException && IGNORABLE_TLS_ERROR_MESSAGE.matcher(msg).find()) {
                  // Can happen when disconnected prematurely.
                  return true;
              }
          }
  
          return false;
      }
docs: Returns {@code true} if the specified exception is expected to occur in well-known circumstances.
  <ul>
  <li>{@link ClosedChannelException}</li>
  <li>{@link ClosedSessionException}</li>
  <li>{@link IOException} - 'Connection reset/closed/aborted by peer'</li>
  <li>'Broken pipe'</li>
  <li>{@link Http2Exception} - 'Stream closed'</li>
  <li>{@link SSLException} - 'SSLEngine closed already'</li>
  </ul>
  
  @see Flags#verboseSocketExceptions()