Fix set encoding should return self

While using the protobuf gem, I encountered a bug in this implementation of StringIO.

https://github.com/localshred/protobuf/blob/9486341f0a/lib/protobuf/message/serialization.rb#L46-L49

That line of code relied on the fact that set_encoding returns self in the MRI implementation:

http://ruby-doc.org/stdlib-2.1.2/libdoc/stringio/rdoc/StringIO.html#method-i-set_encoding

So, I added the return self and a spec to match.