backporting protocol handling from 2.2.x (master).