/** * Returns a test instance of {@link ErrorFrame}. * * @return a test instance of {@link ErrorFrame} */ public static ErrorFrame createTestErrorFrame() { return createErrorFrame(DEFAULT, 1, (ByteBuf) null); }
public static ErrorFrame createTestErrorFrame() { return createErrorFrame(DEFAULT, 1, (ByteBuf) null); }
/** * Creates the {@code ERROR} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param errorCode the error code * @param data the error data * @return the {@code ERROR} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static ErrorFrame createErrorFrame( ByteBufAllocator byteBufAllocator, int errorCode, @Nullable String data) { ByteBuf dataByteBuf = getUtf8AsByteBuf(data); try { return createErrorFrame(byteBufAllocator, errorCode, dataByteBuf); } finally { release(dataByteBuf); } }
@DisplayName("createErrorFrame throws NullPointerException with null byteBufAllocator") @Test void createErrorFrameNullByteBufAllocator() { assertThatNullPointerException() .isThrownBy(() -> createErrorFrame(null, 0, EMPTY_BUFFER)) .withMessage("byteBufAllocator must not be null"); }
return createPayloadFrame(byteBuf); case ERROR: return createErrorFrame(byteBuf); case METADATA_PUSH: return createMetadataPushFrame(byteBuf);
/** * Creates the {@code ERROR} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param errorCode the error code * @param data the error data * @return the {@code ERROR} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static ErrorFrame createErrorFrame( ByteBufAllocator byteBufAllocator, int errorCode, @Nullable String data) { ByteBuf dataByteBuf = getUtf8AsByteBuf(data); try { return createErrorFrame(byteBufAllocator, errorCode, dataByteBuf); } finally { release(dataByteBuf); } }
return createPayloadFrame(byteBuf); case ERROR: return createErrorFrame(byteBuf); case METADATA_PUSH: return createMetadataPushFrame(byteBuf);