Fix broken websocket test

- extract common functionality into a mini reflection library
- made reflection code a lot more robust
- wrote basic test for apply to test slices