Use twisted's defer and QueueRef

Use twisted's defer instead simulation and implment QueueRef