code: public int statusCode() {
          ByteBuf binaryData = content();
          if (binaryData == null || binaryData.capacity() == 0) {
              return -1;
          }
  
          binaryData.readerIndex(0);
          int statusCode = binaryData.readShort();
          binaryData.readerIndex(0);
  
          return statusCode;
      }
docs: Returns the closing status code as per <a href="http://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. If
  a getStatus code is set, -1 is returned.