Rewrite to use net.Listener