I'm running lots of cron job and once in a while there is a *MYSQL has gone away* error.

I've now written some code to handle the error, but how do I simulate the error on my localhost so that the code can be tested thoroughly?