WIP: add initial gateway tests
WIP: implement gateway features as specified in tests