[minor] Move the `type` function to the prototype.
[minor] Allow number in addition to strings for timeout.
[minor] Allow unknown rpc to be intercepted by user code.
[test] Fixed broken test, was caused by broken dependency.