stream: start on stream abstraction.

This will be needed so we can transparently support TLS as well as simplify
socket support on Windows. Additionally, higher level drivers such as PHP
will want to use their own stream abstraction and this should provide the
necessary mechanism to do so.