[PATCH v4 14/19] test: Improve handling of sending commands