Buggy code:
public class AnnotationMethodMessageHandler implements InitializingBean , ApplicationContextAware , MessageHandler { private static final Log logger = LogFactory . getLog ( AnnotationMethodMessageHandler . class ) ; private final SimpMessageSendingOperations brokerTemplate ; private final SimpMessageSendingOperations webSocketResponseTemplate ; private Collection < String > destinationPrefixes = new ArrayList < String > ( ) ; private MessageConverter < ? > messageConverter ; private ApplicationContext applicationContext ; private Map < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > messageMethods = new HashMap < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > ( ) ; private Map < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > subscribeMethods = new HashMap < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > ( ) ; private Map < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > unsubscribeMethods = new HashMap < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > ( ) ; private final Map < Class < ? > , ExceptionHandlerMethodResolver > exceptionHandlerCache = new ConcurrentHashMap < Class < ? > , ExceptionHandlerMethodResolver > ( 64 ) ; private List < HandlerMethodArgumentResolver > customArgumentResolvers = new ArrayList < HandlerMethodArgumentResolver > ( ) ; private List < HandlerMethodReturnValueHandler > customReturnValueHandlers = new ArrayList < HandlerMethodReturnValueHandler > ( ) ; private HandlerMethodArgumentResolverComposite argumentResolvers = new HandlerMethodArgumentResolverComposite ( ) ; private HandlerMethodReturnValueHandlerComposite returnValueHandlers = new HandlerMethodReturnValueHandlerComposite ( ) ; public AnnotationMethodMessageHandler ( SimpMessageSendingOperations brokerTemplate , MessageChannel webSocketResponseChannel ) { } public void setDestinationPrefixes ( Collection < String > destinationPrefixes ) { } public Collection < String > getDestinationPrefixes ( ) { } public void setMessageConverter ( MessageConverter < ? > converter ) { } public void setCustomArgumentResolvers ( List < HandlerMethodArgumentResolver > customArgumentResolvers ) { } public void setCustomReturnValueHandlers ( List < HandlerMethodReturnValueHandler > customReturnValueHandlers ) { } public MessageConverter < ? > getMessageConverter ( ) { } @ Override public void setApplicationContext ( ApplicationContext applicationContext ) throws BeansException { } @ Override public void afterPropertiesSet ( ) { } protected final void initHandlerMethods ( ) { } protected boolean isHandler ( Class < ? > beanType ) { } protected final void detectHandlerMethods ( Object handler ) { } private < A extends Annotation > void initHandlerMethods ( Object handler , Class < ? > handlerType , final Class < A > annotationType , Map < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > handlerMethods ) { } private HandlerMethod createHandlerMethod ( Object handler , Method method ) { } @ Override public void handleMessage ( Message < ? > message ) throws MessagingException { } private void handleMessageInternal ( Message < ? > message , Map < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > handlerMethods ) { if ( AnnotationMethodMessageHandler . logger . isTraceEnabled ( ) ) { AnnotationMethodMessageHandler . logger . trace ( ( "Message<seq2seq4repair_space>" + message ) ) ; } SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor . wrap ( message ) ; String lookupPath = getLookupPath ( headers . getDestination ( ) ) ; if ( lookupPath == null ) { if ( AnnotationMethodMessageHandler . logger . isTraceEnabled ( ) ) { AnnotationMethodMessageHandler . logger . trace ( ( "Ignoring<seq2seq4repair_space>message<seq2seq4repair_space>with<seq2seq4repair_space>destination<seq2seq4repair_space>" + ( headers . getDestination ( ) ) ) ) ; } return ; } HandlerMethod match = getHandlerMethod ( lookupPath , handlerMethods ) ; if ( match == null ) { if ( AnnotationMethodMessageHandler . logger . isTraceEnabled ( ) ) { AnnotationMethodMessageHandler . logger . trace ( ( "No<seq2seq4repair_space>matching<seq2seq4repair_space>method,<seq2seq4repair_space>lookup<seq2seq4repair_space>path<seq2seq4repair_space>" + lookupPath ) ) ; } return ; } HandlerMethod handlerMethod = match . createWithResolvedBean ( ) ; InvocableHandlerMethod invocableHandlerMethod = new InvocableHandlerMethod ( handlerMethod ) ; invocableHandlerMethod . setMessageMethodArgumentResolvers ( this . argumentResolvers ) ; try { headers . setDestination ( lookupPath ) ; <START_BUG> message = MessageBuilder . withPayloadAndHeaders ( message . getPayload ( ) , headers ) . build ( ) ; <END_BUG> Object returnValue = invocableHandlerMethod . invoke ( message ) ; MethodParameter returnType = handlerMethod . getReturnType ( ) ; if ( void . class . equals ( returnType . getParameterType ( ) ) ) { return ; } this . returnValueHandlers . handleReturnValue ( returnValue , returnType , message ) ; } catch ( Exception ex ) { invokeExceptionHandler ( message , handlerMethod , ex ) ; } catch ( Throwable ex ) { AnnotationMethodMessageHandler . logger . error ( ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>processing<seq2seq4repair_space>message<seq2seq4repair_space>" + message ) , ex ) ; } } private String getLookupPath ( String destination ) { } private void invokeExceptionHandler ( Message < ? > message , HandlerMethod handlerMethod , Exception ex ) { } protected HandlerMethod getHandlerMethod ( String destination , Map < AnnotationMethodMessageHandler . MappingInfo , HandlerMethod > handlerMethods ) { } private static class MappingInfo { private final String [ ] destinations ; public MappingInfo ( String [ ] destinations ) { } public String [ ] getDestinations ( ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object o ) { } @ Override public String toString ( ) { } } }

Fix:
message = MessageBuilder . withPayload ( message . getPayload ( ) ) . setHeaders ( headers ) . build ( ) ;