Plato’s Republic, Book II (around 361e–362a), in Glaucon’s challenge to Socrates about the fate of a perfectly just man who has a reputation for injustice.
“What they will say is this: that such being his disposition the just man will have to endure the lash, the rack, chains, the branding-iron in his eyes, and finally, after every extremity of suffering, he will be crucified [or strictly, impaled], and so will learn his lesson that not to be but to seem just is what we ought to desire.”
— Paul Shorey translation)
A common older version (in the style of Jowett) runs:
“They will tell you that the just man who is thought unjust will be scourged, racked, bound—will have his eyes burnt out; and, at last, after suffering every kind of evil, he will be impaled. Then he will understand that he ought to seem only, and not to be, just.”