In ZK 3.5.x there is a method for this:
client.getTestable().injectSessionExpiration();
-JZ
> On Jun 22, 2016, at 3:18 PM, Irfan Hamid <[email protected]> wrote:
>
> Hi,
>
> I'm testing some client code against a ZK cluster, and since it's local
> testing I can use a single ZK instance as well if need be. I'm trying to
> simulate an expired connection so I can validate my reconnect logic. I've
> tried the following:
>
> 1. Single ZK server: connect from client, then kill -9 zkpid (this results
> in disconnect). Try waiting a long time then restart ZK server, it
> reconnects;
> 2. Multiple ZK server quorum: connect from client, then kill -9 zkpid (the
> one client connected to). This causes the client to be disconnected and
> then connects to a different quorum server, until there is no majority left
> active (1 out of 3) and then it can't reconnect.
>
> Is there an easy way for me to simulate an end-to-end scenario outside of
> unit-tests that lets me see the behavior of my reconnect logic?
>
> Thanks,
> Irfan.