code: public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
          throws RemoteException
      {
          String strCommand = this.getProperty(REMOTE_COMMAND, properties);
          try {
              if (FREE_REMOTE_SESSION.equals(strCommand))
              {
                  ((BaseSession)m_remoteObject).freeRemoteSession();
                  this.free();    // Free this (peer's) resources.
              }
              else if (MAKE_REMOTE_SESSION.equals(strCommand))
              {
                  String strSessionClassName = this.getNextStringParam(in, NAME, properties);
                  RemoteBaseSession remoteSession = ((RemoteBaseSession)m_remoteObject).makeRemoteSession(strSessionClassName);
                  this.setReturnSessionOrObject(out, remoteSession);
              }
              else if (DO_REMOTE_ACTION.equals(strCommand))
              {
                  String strAction = this.getNextStringParam(in, NAME, properties);
                  Map<String,Object> propIn = this.getNextPropertiesParam(in, PROPERTIES, properties);
                  if (propIn != null)
                      properties.putAll(propIn);
                  Object objReturn = ((RemoteBaseSession)m_remoteObject).doRemoteAction(strAction, properties);
                  this.setReturnSessionOrObject(out, objReturn);  // Could be a session.
              }
              else
                  super.doProcess(in, out, properties);
          } catch (Exception ex)    {
              // ex.printStackTrace();    // Don't print this error, since I am returning it to my ajax caller.
              this.setReturnObject(out, ex);
          }
      }
docs: Handle the command send from my client peer.
  @param in The (optional) Inputstream to get the params from.
  @param out The stream to write the results.