public void write(final ByteBuffer buffer) {
        if (!isClosed.get()) {
            try {
                channel.write(buffer);
            } catch (IOException e) {
                isClosed.compareAndSet(false, true);
                LOG.error("write buffer Failed.", e);
            }
        }
    }
@Test
    public void testWrite() {
        ByteBuffer byteBuffer = ByteBuffer.wrap(sendString.getBytes(StandardCharsets.UTF_8));
        writer.write(byteBuffer.asReadOnlyBuffer());
        String res = writer.output();
        Assertions.assertEquals(res, "hello, shenyu");
    }