ErrorFrameCodec { public static ByteBuf encode( ByteBufAllocator allocator, int streamId, Throwable t, ByteBuf data) { ByteBuf header = FrameHeaderCodec.encode(allocator, streamId, FrameType.ERROR, 0); int errorCode = t instanceof RSocketErrorException ? ((RSocketErrorException) t).errorCode() : APPLICATION_ERROR; header.writeInt(errorCode); return allocator.compositeBuffer(2).addComponents(true, header, data); }  static ByteBuf encode(
      ByteBufAllocator allocator, int streamId, Throwable t, ByteBuf data); static ByteBuf encode(ByteBufAllocator allocator, int streamId, Throwable t); static int errorCode(ByteBuf byteBuf); static ByteBuf data(ByteBuf byteBuf); static String dataUtf8(ByteBuf byteBuf); static final int INVALID_SETUP; static final int UNSUPPORTED_SETUP; static final int REJECTED_SETUP; static final int REJECTED_RESUME; static final int CONNECTION_ERROR; static final int CONNECTION_CLOSE; static final int APPLICATION_ERROR; static final int REJECTED; static final int CANCELED; static final int INVALID; static final int MIN_USER_ALLOWED_ERROR_CODE; static final int MAX_USER_ALLOWED_ERROR_CODE; }
@Test void testEncode() { ByteBuf frame = ErrorFrameCodec.encode(ByteBufAllocator.DEFAULT, 1, new ApplicationErrorException("d")); frame = FrameLengthCodec.encode(ByteBufAllocator.DEFAULT, frame.readableBytes(), frame); assertEquals("00000b000000012c000000020164", ByteBufUtil.hexDump(frame)); frame.release(); }