Decoupled announcing exception from rethrowing it.
Fix provider thread safety.

Moved the locks close to the libssh2 calls and maintain the mutex in the session object.

This fixes the problem of streams not being thread safe and reduces the time the methods are locked.

Closes #59.