Added a delay function which causes the request to halt for N ms before replying.