Adding a general handler for upgrading protocols