Update Gateway code to test on STDOUT rather than returning bytes