anchor.diff:      ?assertEqual({error, timeout}, list_keys(Pid, <<"b">>, 10)),
       stop(Pid).
   
  +auto_reconnect_bad_connect_test() ->
  +    %% Start with an unlikely port number
  +    {ok, Pid} = start({127,0,0,1}, 65535, [auto_reconnect]),
  +    ?assertEqual({false, [{econnrefused,1}]}, is_connected(Pid)),
  +    ?assertEqual({error, disconnected}, ping(Pid)),
  +    ?assertEqual({error, disconnected}, list_keys(Pid, <<"b">>)),
  +    stop(Pid).
  +
   server_closes_socket_test() ->
       %% Set up a dummy socket to send requests on
       {ok, Listen} = gen_tcp:listen(0, [binary, {packet, 4}, {active, false}]),
       {ok, Port} = inet:port(Listen),
  -    {ok, Pid} = start_link("127.0.0.1", Port),
  +    {ok, Pid} = start("127.0.0.1", Port),
  +    Mref = erlang:monitor(process, Pid),
  +    {ok, Sock} = gen_tcp:accept(Listen),
  +    ?assertMatch(true, is_connected(Pid)),
  +
  +    %% Send a ping request in another process so the test doesn't block
  +    Self = self(),
  +    spawn(fun() -> Self ! ping(Pid, infinity) end),
  +
  +    %% Make sure request received then close the socket
  +    {ok, _ReqMsg} = gen_tcp:recv(Sock, 0),
  +    ok = gen_tcp:close(Sock),
  +    ok = gen_tcp:close(Listen),
  +    receive
  +        Msg1 ->
  +            ?assertEqual({error, disconnected}, Msg1)
  +    end,
  +    receive
  +        Msg2 ->
  +            ?assertMatch({'DOWN', Mref, process, _, _}, Msg2)
  +    end.
  +
  +auto_reconnect_server_closes_socket_test() ->
  +    %% Set up a dummy socket to send requests on
  +    {ok, Listen} = gen_tcp:listen(0, [binary, {packet, 4}, {active, false}]),
  +    {ok, Port} = inet:port(Listen),
  +    {ok, Pid} = start_link("127.0.0.1", Port, [auto_reconnect]),
       {ok, Sock} = gen_tcp:accept(Listen),
       ?assertMatch(true, is_connected(Pid)),
   
  
positive.code: -type address() :: string() | atom() | ip_address().
  -type portnum() :: non_neg_integer().
  -type options() :: [option()].
  -type option()  :: queue_if_disconnected.
  -type client_id() :: binary().
  -type bucket() :: binary().
  -type key() :: binary().
  
negative.code:     spawn(fun() -> Self ! (catch ping(Pid, infinity)) end),
  
      %% Make sure request received then kill the process
      {ok, _ReqMsg} = gen_tcp:recv(Sock, 0),
      exit(Pid, kill),
      receive
          Msg ->
  