update the result processing to be iterator-based, rather than reading all socket content to an array
update tests so that assertion messages use the right order of comparison