Also, secretaries who recorded speeches in shorthand were a well established institution is ancient Greece and Rome. Since Socrates was a celebrity teacher, it's likely his every speech (after becoming famous) was taken down verbatim.
Well, Plato and Xenophon both present Socrates' Apology speech, and their versions are almost completely different. So at least one of them is made-up, rather than being a verbatim copy; probably both of them are (to some extent) fictitious.