code: void checkThrown() throws SSLException {
          synchronized (thrownLock) {
              if (thrown != null) {
  
                  String msg = thrown.getMessage();
  
                  if (msg == null) {
                      msg = "Delegated task threw Exception/Error";
                  }
  
                  /*
                   * See what the underlying type of exception is.  We should
                   * throw the same thing.  Chain thrown to the new exception.
                   */
                  Exception e = thrown;
                  thrown = null;
  
                  if (e instanceof RuntimeException) {
                      throw (RuntimeException)
                          new RuntimeException(msg).initCause(e);
                  } else if (e instanceof SSLHandshakeException) {
                      throw (SSLHandshakeException)
                          new SSLHandshakeException(msg).initCause(e);
                  } else if (e instanceof SSLKeyException) {
                      throw (SSLKeyException)
                          new SSLKeyException(msg).initCause(e);
                  } else if (e instanceof SSLPeerUnverifiedException) {
                      throw (SSLPeerUnverifiedException)
                          new SSLPeerUnverifiedException(msg).initCause(e);
                  } else if (e instanceof SSLProtocolException) {
                      throw (SSLProtocolException)
                          new SSLProtocolException(msg).initCause(e);
                  } else {
                      /*
                       * If it's SSLException or any other Exception,
                       * we'll wrap it in an SSLException.
                       */
                      throw (SSLException)
                          new SSLException(msg).initCause(e);
                  }
              }
          }
      }
docs: /*
  The previous caller failed for some reason, report back the
  Exception.  We won't worry about Error's.
  
  Locked by SSLEngine.this.