lib/libevent: move read and write callbacks implementation from C to Nit