Test code:  separate out communication handling