kmshttpendpoint: Change internal pipeline state in internal thread.

Change state operations may be locking under some cases. We move this stuff to
the internal thread in order not to block main thread when the change of
state is blocking

Change-Id: I520bfb2e6b6379ee9aaf0b5378c281648884f80c