Mock Sockets and related types, used for testing socket code
Mockets currently only implement
SOCK_STREAM. They also don't
shutdown() operations of real sockets, or the
recv(). They don't support out of band data,
exception conditions, or anything else whose implementation is too platform
Some of these limitations may be lifted later, e.g.
sendto(), if/when we need to test things that use them.
We should probably also at least support storing and retrieving options via
setsockopt() methods, so that tests can verify
whether code is setting options that should be set.
Note that real sockets'
makefile() behavior is extremely
platform-dependent, to the point that we should simply avoid them altogether
if possible. In particular,
shutdown() on Windows seems to be seriously
makefile() on Windows, RISCOS, and BeOS is emulated with a
crude simulation of a file that doesn't support most real file operations.