Use the protocol version from the handshake

I unnoticeably used the protocol version from the record layer thinking
I was using the protocol version from the handshake. This commit fix
this and uses the protocol version from the handshake instead of the
record layer like it is on https://gist.github.com/rcvalle/10335282 and
should have been initially.

Thanks to @wvu-r7 for finding this out!