finalized write_nonblock and proto_write API