public Optional<Throwable> getError() {
        return error != null ? Optional.of(error) : Optional.empty();
    }
@Test
    void testGetError() {
        Throwable error = new RuntimeException("test exception");
        NettyPayload nettyPayload = NettyPayload.newError(error);
        assertThat(nettyPayload.getError()).isPresent();
        assertThat(nettyPayload.getError()).hasValue(error);
        assertThatThrownBy(() -> NettyPayload.newError(null))
                .isInstanceOf(NullPointerException.class);
    }