The best example of Shakespeare in The Adventures of Huckleberry Finn is when Huck and Jim are at the mercy of the King and the Duke and their dubious versions of Shakespeare plays.
Twain uses allusions to Shakespeare to entertain learned readers and add an element of intelligent comedy and social satire to the confidence men the King and the Duke. They pretend they know what they are doing, and the people they perform in front of know no different. It sounds good, because it’s Shakespeare, but it is really a crazy jumble of different Shakespeare plays.
The Duke comments that Hamet’s soliloquy would be perfect for the performance, but he doesn’t have it because he’s “only got one volume” (ch 21, enotes etext pdf p. 91).
“Hamlet's soliloquy, you know; the most celebrated thing in Shakespeare. Ah, it's sublime, sublime! Always fetches the house. I haven't got it in the book— I've only got one volume—but I reckon I can piece it out from memory…” (ch 21, p. 91)
What follows is famous lines from several different plays, beginning with Hamlet’s famous “to be or not to be” and then going into Macbeth’s till Birnam Wood do come to Dunsinane” and “Murders the innocent sleep” interspersed with other lines from Hamlet’s soliloquy.
The joke is that these men are obviously frauds, but the people do not notice because they are uneducated, drunk, or not paying attention.