code: public StompFrame decode(ChannelBuffer buffer) throws Exception {
          FrameHeader header = decodeHeader( buffer );
  
          if (header == null) {
              return null;
          }
  
          int len = header.getContentLength();
  
          ChannelBuffer content = null;
  
          if (len <= 0) {
              content = readUntilNull( buffer );
          } else {
              content = readUntil( buffer, len );
          }
  
          StompFrame frame = null;
  
          if (content != null) {
              if (header.isContentFrame()) {
                  frame = new StompContentFrame( header, content );
              } else {
                  frame = new StompControlFrame( header );
              }
          }
  
          return frame;
      }
docs: ------------------------------------------------------------------------