Protocols remote shutdown arg

Note that this is based on gh-882; only the last commit, da678e4, is part of this pull req.

@MichaelMayorov