'net' module: tests and fixes

So far this updates #308 with a very basic test suite, and fixes IPv4 and/or IPv6 address detection.
To me the third option is the only one that seems correct. If the platform is limited to seven sockets, I would simply expect to get ENOENT when I open an 8th active socket. (If it makes sense in a particular application to try clean up sockets more aggressively, then `.setTimeout` could be enlisted as one of the app-level strategies but I don't think it makes sense to try "make extra sockets" at the runtime/firmware level.)