My first stab at unittests for the recon middleware. Also, made some minor changes to the middleware to make testing easier now and down the road. Change-Id: I23ce853398ff035ffbfc2082e90e22038832b966