public static ChannelBuffer buffer(int capacity) {
        if (capacity < 0) {
            throw new IllegalArgumentException("capacity can not be negative");
        }
        if (capacity == 0) {
            return EMPTY_BUFFER;
        }
        return new HeapChannelBuffer(capacity);
    }
@Test
    void testBuffer() {
        ChannelBuffer channelBuffer = ChannelBuffers.buffer(DEFAULT_CAPACITY);
        Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer);
        channelBuffer = ChannelBuffers.buffer(0);
        Assertions.assertEquals(channelBuffer, EMPTY_BUFFER);
    }