Added socketstream to client library. Fixed use of non-treadsafe classes in connection.