multiple (sub)protocol handling in handshake

A new pull request (github reports "able to merge") for changes to support multiple (sub)protocols. Previous pull request #187 is closed.