Added an assertion checking if the client is actually connected when process_events is called.