@Override
    protected Msg xrecv (int flags_)
    {
        //  If we are in middle of sending a reply, we cannot receive next request.
        if (sending_reply) {
            throw new IllegalStateException("Cannot receive another request");
        }

        //  First thing to do when receiving a request is to copy all the labels
        //  to the reply pipe.
        if (request_begins) {
            while (true) {
                Msg msg_ = super.xrecv (flags_);
                if (msg_ == null)
                    return null;
                
                if (msg_.has_more()) {
                    //  Empty message part delimits the traceback stack.
                    boolean bottom = (msg_.size () == 0);
                    
                    //  Push it to the reply pipe.
                    boolean rc = super.xsend (msg_, flags_);
                    assert (rc);
                    if (bottom)
                        break;
                } else {
                    //  If the traceback stack is malformed, discard anything
                    //  already sent to pipe (we're at end of invalid message).
                    super.rollback();
                }
            }
            request_begins = false;
        }

        //  Get next message part to return to the user.
        Msg msg_ = super.xrecv (flags_);
        if (msg_ == null)
           return null;

        //  If whole request is read, flip the FSM to reply-sending state.
        if (!msg_.has_more()) {
            sending_reply = true;
            request_begins = true;
        }

        return msg_;
    }