code: protected void ensureTransmittable(String activityName, boolean only) throws IOException {
          // TODO uudashr: do we have to use another exception for this checking?
          SessionState currentState = getSessionState();
          if (!currentState.isTransmittable() || (only && currentState.isReceivable())) {
              throw new IOException("Cannot " + activityName + " while session " + sessionId + " in state " + currentState);
          }
      }
docs: Ensure the session is transmittable. If the session not transmittable
  then an exception thrown.
  
  @param activityName is the activity name.
  @param only set to <tt>true</tt> if you want to ensure transmittable only
  (transceive will not pass), otherwise set to <tt>false</tt>.
  @throws IOException if the session not transmittable (by considering the
  <code>only</code> parameter).