@Override
  public void initialize() {
    // Now create a buffer.
    ByteBuffer bb = ByteBuffer.allocate(byteCount);
    for (CASOperation so : ops) {
      Iterator<String> is = so.getKeys().iterator();
      String k = is.next();
      byte[] keyBytes = KeyUtil.getKeyBytes(k);
      assert !is.hasNext();

      int myOpaque = generateOpaque();
      callbacks.put(myOpaque, so.getCallback());
      byte[] data = so.getData();

      // Custom header
      bb.put(REQ_MAGIC);
      bb.put(cmdMap(so.getStoreType()));
      bb.putShort((short) keyBytes.length);
      bb.put((byte) StoreOperationImpl.EXTRA_LEN); // extralen
      bb.put((byte) 0); // data type
      bb.putShort(((VBucketAware) so).getVBucket(k)); // vbucket
      bb.putInt(keyBytes.length + data.length + StoreOperationImpl.EXTRA_LEN);
      bb.putInt(myOpaque);
      bb.putLong(so.getCasValue()); // cas
      // Extras
      bb.putInt(so.getFlags());
      bb.putInt(so.getExpiration());
      // the actual key
      bb.put(keyBytes);
      // And the value
      bb.put(data);
    }
    // Add the noop
    bb.put(REQ_MAGIC);
    bb.put((byte) NoopOperationImpl.CMD);
    bb.putShort((short) 0);
    bb.put((byte) 0); // extralen
    bb.put((byte) 0); // data type
    bb.putShort((short) 0); // reserved
    bb.putInt(0);
    bb.putInt(terminalOpaque);
    bb.putLong(0); // cas

    bb.flip();
    setBuffer(bb);
  }
Construct an optimized get starting with the given get operation.
src/main/java/net/spy/memcached/protocol/binary/OptimizedSetImpl.java