The Mishna brings a disagreement about a court that arranged to have a halitza performed and it turned out that one of the three members of the court was a relative or could not serve as a judge for some other reason. The Tanna Kamma insists that we need three, while Rabbi Shimon and Rabbi Yohanan HaSandlar (the Cobbler) believe that two will suffice. The Mishna concludes by telling a story about a case where a yavam and a yevama were in prison together and they performed halitza on their own, which was accepted by Rabbi Akiva as valid.
This story appears in greater detail in the Tosefta and the Talmud Yerushalmi. It took place toward the end of the Bar Kokhba rebellion, when the Roman decrees against the Jews were being carried out with great ferocity, and all Torah study was forbidden. At that time, Rabbi Akiva was being held in prison, and in order to hide the fact that a question of religious law was being discussed, Rabbi Yohanan HaSandlar, a close student of Rabbi Akiva, disguised himself as a peddler. He marched back and forth in front of the prison windows, announcing the goods that he had for sale, but also interspersing questions for his mentor: “Who would like to buy needles? Who would like to buy forks? What about private halitza with only the principals present?”
Rabbi Akiva answered in a similar vein so that their conversation appeared to be one of bargaining over a sale and purchase, rather than a discussion of the halakha.
Although we do not accept the ruling of Rabbi Akiva or of Rabbi Yohanan HaSandlar, the Gemara nevertheless examines their story, asking, for example, whether it was the halitza or the ruling that took place in prison. Rav Yehuda quotes Rav as asserting that they both took place in prison. The Yam shel Shlomo explains that even though we do not accept Rabbi Akiva’s ruling, there is still much to learn from this story. Among other things, we see that had there been three people, the halitza would certainly have been valid, even though it was not a formal beit din.