Buggy code:
public class AnnotationMessageService extends AbstractMessageService implements InitializingBean , ApplicationContextAware { private List < MessageConverter > messageConverters ; private ApplicationContext applicationContext ; private Map < AnnotationMessageService . MappingInfo , HandlerMethod > messageMethods = new HashMap < AnnotationMessageService . MappingInfo , HandlerMethod > ( ) ; private Map < AnnotationMessageService . MappingInfo , HandlerMethod > subscribeMethods = new HashMap < AnnotationMessageService . MappingInfo , HandlerMethod > ( ) ; private Map < AnnotationMessageService . MappingInfo , HandlerMethod > unsubscribeMethods = new HashMap < AnnotationMessageService . MappingInfo , HandlerMethod > ( ) ; private ArgumentResolverComposite argumentResolvers = new ArgumentResolverComposite ( ) ; private ReturnValueHandlerComposite returnValueHandlers = new ReturnValueHandlerComposite ( ) ; public AnnotationMessageService ( EventBus eventBus ) { } public void setMessageConverters ( List < MessageConverter > converters ) { } @ Override public void setApplicationContext ( ApplicationContext applicationContext ) throws BeansException { } @ Override public void afterPropertiesSet ( ) { } protected void initHandlerMethods ( ) { } protected boolean isHandler ( Class < ? > beanType ) { } protected void detectHandlerMethods ( Object handler ) { } @ SuppressWarnings ( "unchecked" ) private < A extends Annotation > void initHandlerMethods ( Object handler , Class < ? > handlerType , final Class < A > annotationType , AnnotationMessageService . MappingInfoCreator mappingInfoCreator , Map < AnnotationMessageService . MappingInfo , HandlerMethod > handlerMethods ) { } protected HandlerMethod createHandlerMethod ( Object handler , Method method ) { } @ Override protected void processMessage ( Message < ? > message ) { } @ Override protected void processSubscribe ( Message < ? > message ) { } @ Override protected void processUnsubscribe ( Message < ? > message ) { } private void handleMessage ( final Message < ? > message , Map < AnnotationMessageService . MappingInfo , HandlerMethod > handlerMethods ) { <START_BUG> PubSubHeaders headers = new PubSubHeaders ( message . getHeaders ( ) , true ) ; <END_BUG> String destination = headers . getDestination ( ) ; HandlerMethod match = getHandlerMethod ( destination , handlerMethods ) ; if ( match == null ) { return ; } HandlerMethod handlerMethod = match . createWithResolvedBean ( ) ; InvocableMessageHandlerMethod invocableHandlerMethod = new InvocableMessageHandlerMethod ( handlerMethod ) ; invocableHandlerMethod . setMessageMethodArgumentResolvers ( this . argumentResolvers ) ; try { Object value = invocableHandlerMethod . invoke ( message ) ; MethodParameter returnType = handlerMethod . getReturnType ( ) ; if ( void . class . equals ( returnType . getParameterType ( ) ) ) { return ; } this . returnValueHandlers . handleReturnValue ( value , returnType , message ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } protected HandlerMethod getHandlerMethod ( String destination , Map < AnnotationMessageService . MappingInfo , HandlerMethod > handlerMethods ) { } private static class MappingInfo { private final List < String > destinations ; public MappingInfo ( List < String > destinations ) { } public List < String > getDestinations ( ) { } @ Override public String toString ( ) { } } private interface MappingInfoCreator < A extends Annotation > { AnnotationMessageService . MappingInfo create ( A annotation ) { } } private static class MessageMappingInfoCreator implements AnnotationMessageService . MappingInfoCreator < MessageMapping > { @ Override public AnnotationMessageService . MappingInfo create ( MessageMapping annotation ) { } } private static class SubscribeMappingInfoCreator implements AnnotationMessageService . MappingInfoCreator < SubscribeEvent > { @ Override public AnnotationMessageService . MappingInfo create ( SubscribeEvent annotation ) { } } private static class UnsubscribeMappingInfoCreator implements AnnotationMessageService . MappingInfoCreator < UnsubscribeEvent > { @ Override public AnnotationMessageService . MappingInfo create ( UnsubscribeEvent annotation ) { } } }

Fix:
PubSubHeaders headers = PubSubHeaders . fromMessageHeaders ( message . getHeaders ( ) ) ;