Exemple #1
0
        public async Task testNonExistingOpCode()
        {
            ZooKeeper zk = await createClient();

            const string path = "/m1";

            RequestHeader h = new RequestHeader();

            h.set_Type(888); // This code does not exists
            ExistsRequest request = new ExistsRequest();

            request.setPath(path);
            request.setWatch(false);
            ExistsResponse response = new ExistsResponse();
            ReplyHeader    r        = await zk.cnxn.submitRequest(h, request, response, null);

            Assert.assertEquals(r.getErr(), (int)KeeperException.Code.UNIMPLEMENTED);

            try {
                await zk.existsAsync("/m1", false);

                Assert.fail("The connection should have been closed");
            }
            catch (KeeperException.ConnectionLossException) {
            }
        }
Exemple #2
0
        public async Task testNonExistingOpCode()
        {
            DisconnectedWatcher disconnectedWatcher = new DisconnectedWatcher();
            ZooKeeper           zk = await createClient(disconnectedWatcher);

            const string path = "/m1";

            RequestHeader h = new RequestHeader();

            h.set_Type(888); // This code does not exists
            ExistsRequest request = new ExistsRequest();

            request.setPath(path);
            request.setWatch(false);
            ExistsResponse response = new ExistsResponse();

            ReplyHeader r = await zk.cnxn.submitRequest(h, request, response, null);

            Assert.assertEquals(r.getErr(), (int)KeeperException.Code.UNIMPLEMENTED);

            // Sending a nonexisting opcode should cause the server to disconnect
            Assert.assertTrue("failed to disconnect",
                              await disconnectedWatcher.getTask().WithTimeout(5000));
        }