/** * Returns a test instance of {@link CancelFrame}. * * @return a test instance of {@link CancelFrame} */ public static CancelFrame createTestCancelFrame() { return createCancelFrame(DEFAULT); }
/** * Creates the {@code CANCEL} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @return the {@code CANCEL} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static CancelFrame createCancelFrame(ByteBufAllocator byteBufAllocator) { ByteBuf byteBuf = createFrameTypeAndFlags(byteBufAllocator, CANCEL); return RECYCLER.get().setByteBuf(byteBuf); }
/** * Creates the {@code CANCEL} frame. * * @param byteBuf the {@link ByteBuf} representing the frame * @return the {@code CANCEL} frame * @throws NullPointerException if {@code byteBuf} is {@code null} */ public static CancelFrame createCancelFrame(ByteBuf byteBuf) { Objects.requireNonNull(byteBuf, "byteBuf must not be null"); return RECYCLER.get().setByteBuf(byteBuf.retain()); }
@DisplayName("creates CANCEL frame") @Test void createFrameCancel() { createTestCancelFrame() .consumeFrame(byteBuf -> assertThat(createFrame(byteBuf)).isInstanceOf(CancelFrame.class)); }
/** * Creates the {@code CANCEL} frame. * * @param byteBuf the {@link ByteBuf} representing the frame * @return the {@code CANCEL} frame * @throws NullPointerException if {@code byteBuf} is {@code null} */ public static CancelFrame createCancelFrame(ByteBuf byteBuf) { Objects.requireNonNull(byteBuf, "byteBuf must not be null"); return RECYCLER.get().setByteBuf(byteBuf.retain()); }
public static CancelFrame createTestCancelFrame() { return createCancelFrame(DEFAULT); }
/** * Creates the {@code CANCEL} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @return the {@code CANCEL} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static CancelFrame createCancelFrame(ByteBufAllocator byteBufAllocator) { ByteBuf byteBuf = createFrameTypeAndFlags(byteBufAllocator, CANCEL); return RECYCLER.get().setByteBuf(byteBuf); }
@DisplayName("createCancelFrame throws NullPointerException with null byteBufAllocator") @Test void createCancelFrameNullByteBufAllocator() { assertThatNullPointerException() .isThrownBy(() -> createCancelFrame((ByteBufAllocator) null)) .withMessage("byteBufAllocator must not be null"); } }
return createRequestNFrame(byteBuf); case CANCEL: return createCancelFrame(byteBuf); case PAYLOAD: return createPayloadFrame(byteBuf);
return createRequestNFrame(byteBuf); case CANCEL: return createCancelFrame(byteBuf); case PAYLOAD: return createPayloadFrame(byteBuf);