Allow to use several connections with thread-local singleton

Change-Id: Iab694b8ba9df2655297fc7e3fc8b2502d139db67
Reviewed-on: http://review.couchbase.org/27961
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>