@Test
    void requireThatPolicyCanDisableReselectOnRetry() {
        SimpleProtocol protocol = new SimpleProtocol();
        protocol.addPolicyFactory("Custom", new CustomPolicyFactory(false));
        srcServer.mb.putProtocol(protocol);
        assertTrue(srcSession.send(createMessage("msg"), Route.parse("[Custom:" + dstSessName + "]")).isAccepted());
        Message msg = ((Receptor) dstSession.getMessageHandler()).getMessage(60);
        assertNotNull(msg);
        Reply reply = new EmptyReply();
        reply.swapState(msg);
        reply.addError(new Error(ErrorCode.APP_TRANSIENT_ERROR, "err"));
        dstSession.reply(reply);
        assertNotNull(msg = ((Receptor) dstSession.getMessageHandler()).getMessage(60));
        dstSession.acknowledge(msg);
        assertNotNull(reply = ((Receptor) srcSession.getReplyHandler()).getReply(60));
        assertFalse(reply.hasErrors());
        assertTrace(List.of("Selecting [" + dstSessName + "].",
                        "[APP_TRANSIENT_ERROR @ localhost]",
                        "-[APP_TRANSIENT_ERROR @ localhost]",
                        "Merged [" + dstSessName + "].",
                        "-Selecting [" + dstSessName + "].",
                        "Sending reply",
                        "Merged [" + dstSessName + "]."),
                reply.getTrace());
    }
@author havardpe
@author Simon Thoresen Hult
messagebus/src/test/java/com/yahoo/messagebus/routing/RoutingTestCase.java