@Test
    void requireThatReplyCanBeRemovedAndRetried() {
        SimpleProtocol protocol = new SimpleProtocol();
        protocol.addPolicyFactory("RemoveReply", param -> new RemoveReplyPolicy(false,
                                                                                List.of(ErrorCode.APP_TRANSIENT_ERROR),
                                                                        CustomPolicyFactory.parseRoutes(param),
                                                                        0));
        protocol.addPolicyFactory("SetReply", param -> new SetReplyPolicy(false,
                                                                  List.of(ErrorCode.APP_TRANSIENT_ERROR, ErrorCode.APP_FATAL_ERROR),
                                                                  param));
        srcServer.mb.putProtocol(protocol);
        assertTrue(srcSession
                .send(createMessage("msg"), Route.parse("[RemoveReply:[SetReply:foo]," + dstSessName + "]")).isAccepted());
        Message msg = ((Receptor) dstSession.getMessageHandler()).getMessage(60);
        assertNotNull(msg);
        dstSession.acknowledge(msg);
        Reply reply = ((Receptor) srcSession.getReplyHandler()).getReply(60);
        assertNotNull(reply);
        assertEquals(1, reply.getNumErrors());
        assertEquals(ErrorCode.APP_FATAL_ERROR, reply.getError(0).getCode());
        assertEquals("foo", reply.getError(0).getMessage());
        assertTrace(List.of("Resolving '[SetReply:foo]'.",
                        "Resolving '" + dstSessName + "'.",
                        "Resender resending message.",
                        "Resolving '" + dstSessName + "'.",
                        "Resolving '[SetReply:foo]'."),
                reply.getTrace());
    }
@author havardpe
@author Simon Thoresen Hult
messagebus/src/test/java/com/yahoo/messagebus/routing/RoutingTestCase.java