fixed tests, refactored to stick as much as possible to luasocket syntax and behavior