use of org.apache.zookeeper.MockPacket in project zookeeper by apache.
the class WatchLeakTest method createWatchesMessage.
/**
* Create a watches message with a single watch on /
*
* @return a message that attempts to set 1 watch on /
*/
private ByteBuffer createWatchesMessage() {
List<String> dataWatches = new ArrayList<String>(1);
dataWatches.add("/");
List<String> existWatches = Collections.emptyList();
List<String> childWatches = Collections.emptyList();
SetWatches sw = new SetWatches(1L, dataWatches, existWatches, childWatches);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.setWatches);
h.setXid(-8);
MockPacket p = new MockPacket(h, new ReplyHeader(), sw, null, null);
return p.createAndReturnBB();
}
use of org.apache.zookeeper.MockPacket in project zookeeper by apache.
the class WatchLeakTest method createConnRequest.
/**
* Create a connection request
*
* @return a serialized connection request
*/
private ByteBuffer createConnRequest() {
Random r = new Random(SESSION_ID ^ superSecret);
byte[] p = new byte[16];
r.nextBytes(p);
ConnectRequest conReq = new ConnectRequest(0, 1L, 30000, SESSION_ID, p);
MockPacket packet = new MockPacket(null, null, conReq, null, null, false);
return packet.createAndReturnBB();
}
Aggregations