code: public boolean socketError(Throwable throwable) {
      if (throwable instanceof SocketException || throwable instanceof SocketTimeoutException) {
        return true;
      }
      Throwable cause = throwable.getCause();
      // Subset of SSL exceptions that are caused by IO errors (e.g. SSLHandshakeException due to
      // unexpected connection closure) is also a socket error.
      if (throwable instanceof SSLException && cause != null && ioError(cause)) {
        return true;
      }
      return cause != null && socketError(cause);
    }
docs: Determine if a given Throwable is caused by a socket error.
  Recursively checks getCause() if outer exception isn't
  an instance of the correct class.
  @param throwable The Throwable to check.
  @return True if the Throwable is a result of a socket error.