Track connection refcount to prevent GC races

In certain cases a Mysql2::Client and a Mysql2::Result may be freed
in the same GC run. If the Client is freed before the Result a segv
may occur when the Result tries to use the socket to make sure there
isn't any more data to read before freeing itself.

Huge thanks to @evanphx for helping me track this one down and @rkh
for helping with TravisCI since that's where the issue was finally
reproducable.
If a Result is freed after it's Client, allow it to free the Client's
underlying MYSQL* structure to prevent leaks. This will be pretty
rare but needs to be accounted for.
need to re-think this test
bump timings in this test again
Result objects now keep a reference to the Client that they came from.
Refactor how options and encoding are passed from Client to Result
Merge pull request #381 from sodabrew/client-refcount

Add two refactor commits to the refcount branch
Merge pull request #378 from brianmario/client-refcount

Track connection refcount to prevent GC races