main: add basic functional test

wait on #1315 
it doesn't support TLS now. i will add a todo for it.