print("Running double, super is", super) return { recv = function(self) print("double.recv", "self", self, "super", super) local r1, err = super:recv() if not r1 then print(("first read failed: %s"):format(err)) return nil, err end print(string.format("#1 double.recv() -> %q", r1)) local r2, err = super:recv() if not r2 then print(("second read failed: %s"):format(err)) return nil, err end print(string.format("#2 double.recv() -> %q", r2)) return r1 .. r2 end, send = function(self, data) if data == nil then print("send(nil)") return nil, "EOF" end print(string.format("double.send(%q)", data), "self", self, "super", super) local status, err = super:send(data) print(string.format("#1 double.send(%q)", data)) if not status then return nil, err end local status, err = super:send(data) print(string.format("#2 double.send(%q)", data)) if not status then return nil, err end return true end, }