AWS SQS RegisterHandler not firing in testing environment

The code I use to setup the initial SqsMqServer is the same for the test as for my actual self hosted application. That works fine, I can post a message directly to a queue all day and watch the breakpoint fire… but when doing the exact same thing in a unit/integration test it never fires the registered callback.

I am trying to test the _sqsMqServer.RegisterHandler() but it never calls back in my test. I can see the queue appear and I can see the message is publishing in there… but it simply never fires off the callback in the RegisterHandler…

Any ideas are welcome… I’m stumped

    public void SQS_CanRegisterByTypeAndPublish_RecievesAndCountsMessage()
        var custDemoWrapCalled = 0;
        _sqsMqServer.RegisterHandler<CustomerDemographicsWrapper>(x =>
            System.Diagnostics.Debugger.Break(); //should force the IDE to debug
            Interlocked.Increment(ref custDemoWrapCalled); //stole this from ServiceStack
            return x.GetBody();

        var mqClient = _sqsMqServer.MessageFactory.CreateMessageQueueClient();

        var message = new Message<CustomerDemographicsWrapper>(new CustomerDemographicsWrapper
            CustomerDemographics = new CustomerDemographicsDto
                Attn = "Test from Int. test",
                Name = "Test name Int. test"

        //Publish a message

        var queueMgr = (_sqsMqServer.MessageFactory as ISqsMqMessageFactory).QueueManager;
        var typeName = queueMgr.QueueNameMap.First().Key;

        var queueName = queueMgr.QueueNameMap[typeName];

        //IMessage<CustomerDemographicsWrapper> responseMsg = mqClient.Get<CustomerDemographicsWrapper>(queueName.QueueName);

        WaitUntilTrueOrTimeout(() => custDemoWrapCalled == 1, timeoutSeconds: 10);

        Assert.That(_sqsMqServer.GetStats().TotalMessagesProcessed, Is.EqualTo(1));
        Assert.That(custDemoWrapCalled, Is.EqualTo(1));


    public static void WaitUntilTrueOrTimeout(Func<bool> doneWhenTrue, int timeoutSeconds = 10)
        var timeoutAt = DateTime.UtcNow.AddSeconds(timeoutSeconds);
        while (DateTime.UtcNow <= timeoutAt)
            if (doneWhenTrue())

If you haven’t already try disable buffering, e.g:

container.Register<IMessageService>(c => new SqsMqServer(
    AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1) {
    DisableBuffering = true,