Moar socket errors.
Major refactoring; sockets are created from context.