Use mypy strict optional checks and fix them. Use better comparison for compatiblity output. Add initial socket tests.