Openssl refactor and tests

The first commit refactors the module. The second adds more docs. And the third uses the refactoring to improve the `io.sockets.secure.openssl.tests` so that it will be easier to find the root cause of the #1036 problem. If the tests fail again, they will hopefully throw a very informative error.