@Override
 public void decodeRest(HornetQBuffer buffer) {
   super.decodeRest(buffer);
   handler = buffer.readSimpleString();
   voteBuffer = buffer.readSlice(buffer.readableBytes());
 }
  public StompFrame unmarshal(HornetQBuffer in) throws IOException {

    try {
      String action = null;

      // skip white space to next real action line
      while (true) {
        action = readLine(in, MAX_COMMAND_LENGTH, "The maximum command length was exceeded");
        if (action == null) {
          throw new IOException("connection was closed");
        } else {
          action = action.trim();
          if (action.length() > 0) {
            break;
          }
        }
      }

      // Parse the headers
      HashMap headers = new HashMap(25);
      while (true) {
        String line = readLine(in, MAX_HEADER_LENGTH, "The maximum header length was exceeded");
        if (line != null && line.trim().length() > 0) {

          if (headers.size() > MAX_HEADERS) {
            throw new StompException("The maximum number of headers was exceeded", true);
          }

          try {
            int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
            String name = line.substring(0, seperator_index).trim();
            String value = line.substring(seperator_index + 1, line.length()).trim();
            headers.put(name, value);
          } catch (Exception e) {
            throw new StompException("Unable to parser header line [" + line + "]", true);
          }
        } else {
          break;
        }
      }

      // Read in the data part.
      byte[] data = NO_DATA;
      String contentLength = (String) headers.get(Stomp.Headers.CONTENT_LENGTH);
      if (contentLength != null) {

        // Bless the client, he's telling us how much data to read in.
        int length;
        try {
          length = Integer.parseInt(contentLength.trim());
        } catch (NumberFormatException e) {
          throw new StompException("Specified content-length is not a valid integer", true);
        }

        if (length > MAX_DATA_LENGTH) {
          throw new StompException("The maximum data length was exceeded", true);
        }

        data = new byte[length];
        in.readBytes(data);

        if (in.readByte() != 0) {
          throw new StompException(
              Stomp.Headers.CONTENT_LENGTH
                  + " bytes were read and "
                  + "there was no trailing null byte",
              true);
        }
      } else {

        // We don't know how much to read.. data ends when we hit a 0
        byte b;
        ByteArrayOutputStream baos = null;
        while (in.readableBytes() > 0 && (b = in.readByte()) != 0) {

          if (baos == null) {
            baos = new ByteArrayOutputStream();
          } else if (baos.size() > MAX_DATA_LENGTH) {
            throw new StompException("The maximum data length was exceeded", true);
          }

          baos.write(b);
        }

        if (baos != null) {
          baos.close();
          data = baos.toByteArray();
        }
      }

      return new StompFrame(action, headers, data);
    } catch (StompException e) {
      return new StompFrameError(e);
    }
  }