### Question:
RMSoapOutInterceptor extends AbstractSoapInterceptor { void encode(SoapMessage message) { RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true); if (null != rmps) { encode(message, rmps); } else if (MessageUtils.isFault(message)) { Exception ex = message.getContent(Exception.class); if (ex instanceof SoapFault && ex.getCause() instanceof SequenceFault) { encodeFault(message, (SequenceFault)ex.getCause()); } } } RMSoapOutInterceptor(); Set<QName> getUnderstoodHeaders(); void handleMessage(SoapMessage message); static void encode(SoapMessage message, RMProperties rmps); static void encodeFault(SoapMessage message, SequenceFault sf);  }### Answer:
@Test public void testEncode() throws Exception { RMSoapOutInterceptor codec = new RMSoapOutInterceptor(); setUpOutbound(); SoapMessage message = setupOutboundMessage(); codec.handleMessage(message); verifyHeaders(message, new String[] {}); message = setupOutboundMessage(); RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true); rmps.setSequence(s1); codec.encode(message); verifyHeaders(message, new String[] {RMConstants.SEQUENCE_NAME}); message = setupOutboundMessage(); rmps = RMContextUtils.retrieveRMProperties(message, true); Collection<SequenceAcknowledgement> acks = new ArrayList<>(); acks.add(ack1); rmps.setAcks(acks); codec.encode(message); verifyHeaders(message, new String[] {RMConstants.SEQUENCE_ACK_NAME}); message = setupOutboundMessage(); rmps = RMContextUtils.retrieveRMProperties(message, true); acks.add(ack2); rmps.setAcks(acks); codec.encode(message); verifyHeaders(message, new String[] {RMConstants.SEQUENCE_ACK_NAME, RMConstants.SEQUENCE_ACK_NAME}); message = setupOutboundMessage(); rmps = RMContextUtils.retrieveRMProperties(message, true); Collection<AckRequestedType> requested = new ArrayList<>(); requested.add(ar1); rmps.setAcksRequested(requested); codec.encode(message); verifyHeaders(message, new String[] {RMConstants.ACK_REQUESTED_NAME}); message = setupOutboundMessage(); rmps = RMContextUtils.retrieveRMProperties(message, true); requested.add(ar2); rmps.setAcksRequested(requested); codec.encode(message); verifyHeaders(message, new String[] {RMConstants.ACK_REQUESTED_NAME, RMConstants.ACK_REQUESTED_NAME}); }