Because of their code-breaking, British intelligence was able to catch most German agents as soon as they arrived. Some of them were given the opportunity to "turn double". One example: http://en.wikipedia.org/wiki/Eddie_Chapman
Note that "given the opportunity" meant "given the choice between execution and turning double agent", though some chose to turn themselves in and offer themselves up as double agents of their own will.