refactor rpc listener methods, wait for proper shutdown
refactor rpc listener methods, wait for proper shutdown

dvusboy/nomad,burdandrei/nomad,dvusboy/nomad,burdandrei/nomad,nak3/nomad,hashicorp/nomad,hashicorp/nomad,nak3/nomad,burdandrei/nomad,burdandrei/nomad,nak3/nomad,nak3/nomad,dvusboy/nomad,nak3/nomad,burdandrei/nomad,dvusboy/nomad,nak3/nomad,hashicorp/nomad,dvusboy/nomad,dvusboy/nomad,burdandrei/nomad,nak3/nomad,dvusboy/nomad,hashicorp/nomad,burdandrei/nomad,hashicorp/nomad,hashicorp/nomad