Cache the sucessful protocols

And avoid doing too many failed handshakes.