When Castle and Alexis are fencing, they quote the dialog spoken by Basil Rathbone and Errol Flynn from The Adventures Of Robin Hood (1938).
When Castle greets the mayor at the gala, the mayor says he was unaware Castle would be at the "shindig." "Shindig" is the title of season 1 episode 6 of the short lived Fox sci-fi series "Firefly," in which Nathan Fillion starred as Malcolm Reynolds.