code: protected void ensureReceivable(String activityName) throws IOException {
          // TODO uudashr: do we have to use another exception for this checking?
          SessionState currentState = getSessionState();
          if (!currentState.isReceivable()) {
              throw new IOException("Cannot " + activityName + " while session " + sessionId + " in state " + currentState);
          }
      }
docs: Ensure the session is receivable. If the session not receivable then an
  exception thrown.
  
  @param activityName is the activity name.
  @throws IOException if the session not receivable.