Added tests.
Added callback function to the API for both client/server.