@Override
    public void handleReply(Reply reply) {
        if (failure.get() != null) {
            return;
        }
        if (containsFatalErrors(reply.getErrors())) {
            failure.compareAndSet(null, new IOException(formatErrors(reply)));
            return;
        }
        long now = System.currentTimeMillis();
        long latency = now - (long) reply.getContext();
        numReplies.incrementAndGet();
        accumulateReplies(now, latency);
    }
@Test
    public void requireThatXMLFeederWorks() throws Throwable {
        assertFeed("<vespafeed>" +
                   "    <document documenttype='simple' documentid='id:scheme:simple::0'>" +
                   "        <my_str>foo</my_str>" +
                   "    </document>" +
                   "    <update documenttype='simple' documentid='id:scheme:simple::1'>" +
                   "        <assign field='my_str'>bar</assign>" +
                   "    </update>" +
                   "    <remove documenttype='simple' documentid='id:scheme:simple::2'/>" +
                   "</vespafeed>",
                   new MessageHandler() {

                       @Override
                       public void handleMessage(Message msg) {
                           Reply reply = ((DocumentMessage)msg).createReply();
                           reply.swapState(msg);
                           reply.popHandler().handleReply(reply);
                       }
                   },
                   "",
                   "(.+\n)+" +
                   "\\s*\\d+,\\s*3,.+\n");
    }