Improving the mock.js constructor to better model the real one.

The callback on connection is a critical feature of the real
connection and was missing, so we've added it.
Still room for improvement.