Add raw_string helper in tests, to repair encoding issues

Strings with raw byte sequences misbehave in Ruby 2.0+ because the
default encoding for string literals is now UTF-8. The String#b method
resolves this, and was not previously available.
Work around broken sync_close in OpenSSL::SSL::SSLSocket

ssl_ber_spec showed failures on Ruby 1.9.3, 2.0.0 and 2.1.1 (OS X and
Linux) which could only be resolved by manually closing the underlying
connection. Changing the test to use a TCP socket did not help, so it
seems to be a bug in the SSLSocket class.