Socrates himself couldn't properly articulate it.
Socrates had many chances to flee. It was not merely distaste for cowardice that motivated his stay. Certainly his opponents were dishonourable and treating them poorly could be elaborately justified. No amount of treachery would have been out of bounds.
However, Socrates himself picked the fight. Socrates, of all people was no fool; he knew how it might well end. He could have left well enough alone and been left alone in turn.
To flee would have been to disavow his own actions. To refuse the consequences of his own choices; it is not about the cowardice of his opponents, because he knew all about that going in. He may have hoped they were not NPCs, but it turns out he was right the first time.
To refuse the hemlock would be to refuse Socratesness.
A Socrates, ultimately, profoundly, is a man who dies by getting executed. Socrates, correctly, chose to dishonour life rather than to dishonour the Socratic nature through which his gods created him.
If Socrates had refused the hemlock, we would never know if he would die for his beliefs. Probably, sure. This way we can be 100% sure. Socrates believed the Socratic way is worth dying for. In the absolute, ultimate end, Socrates had no doubts worth the name.