Enable changing handler's operation mode in run-time.

The handler had a bug when switching from async to sync, and vice-versa.

Because the handler variable was final, switching from async to sync would not free the retained memory. Also, and more importantly, if the handler was sync and then switched to async, a NPE would result because the handler was always null from before.

This is now fixed.