public org.omg.CORBA.portable.OutputStream _invoke (String $method,
                                org.omg.CORBA.portable.InputStream in,
                                org.omg.CORBA.portable.ResponseHandler $rh)
  {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue ())
    {

  /**
           * Used to inform this channel element which the other
           * side is such that they can relay a signal or disconnect.
           */
       case 0:  // RTT/corba/CRemoteChannelElement/setRemoteSide
       {
         RTT.corba.CRemoteChannelElement other = RTT.corba.CRemoteChannelElementHelper.read (in);
         this.setRemoteSide (other);
         out = $rh.createReply();
         break;
       }


  /**
           * Used by the 'remote' side to inform this channel element that new data
           * is available for reading.
           * @return false if this channel became invalidated.
           */
       case 1:  // RTT/corba/CRemoteChannelElement/remoteSignal
       {
         boolean $result = false;
         $result = this.remoteSignal ();
         out = $rh.createReply();
         out.write_boolean ($result);
         break;
       }


  /**
           * Used by the 'remote' side to inform this channel element
           * that the connection is been cleaned up.
           * @param writer_to_reader Since channel elements are chained,
           * we need to know who initiated the disconnect: starting from
           * the output port (writer_to_reader == true) or from the
           * input port (writer_to_reader == false)
           */
       case 2:  // RTT/corba/CRemoteChannelElement/remoteDisconnect
       {
         boolean writer_to_reader = in.read_boolean ();
         this.remoteDisconnect (writer_to_reader);
         out = $rh.createReply();
         break;
       }


  /**
           * Reads from this Channel Element.
           */
       case 3:  // RTT/corba/CChannelElement/read
       {
         org.omg.CORBA.AnyHolder sample = new org.omg.CORBA.AnyHolder ();
         boolean copy_old_data = in.read_boolean ();
         RTT.corba.CFlowStatus $result = null;
         $result = this.read (sample, copy_old_data);
         out = $rh.createReply();
         RTT.corba.CFlowStatusHelper.write (out, $result);
         out.write_any (sample.value);
         break;
       }


  /**
           * Writes into this Channel Element.
           * @return false if the channel became invalid
           */
       case 4:  // RTT/corba/CChannelElement/write
       {
         org.omg.CORBA.Any sample = in.read_any ();
         boolean $result = false;
         $result = this.write (sample);
         out = $rh.createReply();
         out.write_boolean ($result);
         break;
       }


  /**
           * Disconnect and dispose this object.
           * You may no longer use this object after calling this method.
           */
       case 5:  // RTT/corba/CChannelElement/disconnect
       {
         this.disconnect ();
         out = $rh.createReply();
         break;
       }

       default:
         throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke