add unit tests for doCall and closeApiConnection method