Add timeout method and update example.js to work with node 0.8