Historically we do not know what Socrates really thought. We only have primarily Plato and Xenophon to rely on. Xenophon presents a Socrates who is being put to death unjustly and comforts others with the question, "Would you prefer that I was being put to death unjustly or justly?" Socrates is content to die in Xenophon rather than face advanced old age. Plato presents a Socrates who seems to have a more principled take on death (likely thanks to Plato's interpretation). Plato's Socrates is committed to his mission and refuses to stop the activities he associates with philosophy. In the Plato dialogue "Crito" Socrates converses with the laws of athens who convince him it would be unjust for him to escape. If he breaks one law he breaks the whole of the law.
The tone in "Crito" is the opposite of Socrates giving an "FU" to justice. This is consistent with Plato's whole presentation of Socrates, in which he is always devoted to the ideal that human beings should seek to be just and that justice is to be desired.
Socrates choose to remain and die because a) he was not afraid of death. Epictetus noted that Socrates was not afraid of death. Socrates was an inspiration to Zeno (stoic philosophy) partly due to the calm manner in which he faced death. And b) he loved justice.
That is as far as I can take the historical sources with regard to what his contemporaries thought, but it does not tell us what was in his mind.