Our Gemara on Amud Beis tells us about two Jewish persons who encounter King Shapur:
Mar Yehuda, an important personage of the house of the Exilarch, and Bati bar Tuvi, a wealthy man, who were sitting before King Shapur, the king of Persia.
The king’s servants brought an esrog before them. The king cut a slice and ate it, and then he cut a slice and gave it to Bati bar Tuvi. He then stuck the knife ten times in the ground (to scour away any non-kosher grease), cut a slice, and gave it to Mar Yehuda.
(Since he saw that King Shapur did not clean the knife for him) Bati bar Tuvi said to him: “And is that man, referring to myself, not Jewish?”
King Shapur said to him: “I am certain of that master, Mar Yehuda, that he is meticulous about Halacha; but I am not certain of that master, referring to Bati bar Tuvi, that he is meticulous in this regard.”
There are those who say that King Shapur said to him: “Remember what you did last night.” The Persian practice was to present a woman to each guest, with whom he would intimately engage. Mar Yehuda did not accept the woman who was sent to him, but Bati bar Tuvi did, and therefore he was not assumed to be meticulous with regard to eating kosher food.
This story is about the inconsistencies of religious strivings and the ability to compartmentalize. Bati bar Tuvi was makpid to eat kosher, and even insulted at the insinuation that he did not, yet his sexual proclivities were not at that standard.
There was a similar Gemara earlier on daf 69a:
Rava says: In the case of a gentile prostitute, where Jews are dining at her table, the wine at the table is permitted. Granted, their passion for the sin of harlotry overwhelms their judgment, but the passion for wine used for a libation does not overwhelm their judgment, and they will not allow her to use it for a libation.
The courtesan’s clients were careful about yeyn nesech, but not very inhibited regarding their sexual plans. Her Jewish clients were apparently not even embarrassed to dine together!
Tosafos on our Gemara adds a wrinkle: He says Bati bar Tuvi is the same Bati bar Tuvi from the Gemara Kiddushin (70b) which describes a Jewish slave who is given an offer to be freed via a get shichrur, but out of pride (because he did not want it publicized that he was still technically a slave) he refused that option. In that case, Tosafos tells us that although he was obligated to keep Kosher, as a Jewish slave is required, he actually was not forbidden to be with a gentile prostitute because he was not fully Jewish, without having his emancipation document enacted.
As it turns out, the inconsistency in his behavior that King Shapur called him out on was not really hypocritical since the prostitute was not really forbidden to him—or was it hypocritical in the end because of the optics? He was too proud to allow himself to accept his get shichrur—but proud of what? Clearly, he held himself to be a full Jew and had too much dignity to allow anybody to discover that technically he was not. Arrogance and lust are considered co-occurring personality flaws (see Tehilim 101:5 and Radak). At the moment of truth he behaved as a slave, and not as a full Jew.
Tosafos might be telling us this historical fact in order to emphasize that quite the contrary, he kept Kosher because he had to, since even a slave is obligated in Kosher. He thought he was better than he was, and in the end, when confronted with a situation where it was voluntary to abstain from promiscuity—though unseemly, not technically forbidden—he rationalized.