Pass the ssh output socket into nonblocking handle timeout when writting to it

This code is heavily based on libfetch(3) one