Before he became the king of Hanover, the notorious Duke of Cumberland stood against the media in a courtroom trial which engrossed the nation. Accused in an 1832 book of murdering his valet, the duke took to the stand to discredit the book’s claims and its publisher, writes Dr Madeleine Pelling