When Joseph's brothers came before him, he pretended not to know them and accused them of being spies. He took one of them, Shimon, and imprisoned him and demanded that they come back with Benjamin. Then, he framed Benjamin and had him taken prisoner.
Why was all this necessary? Why didn't Joseph tell his brothers who he was immediately?
Joseph understood the spiritual ramifications of his brothers' selling him into slavery and he wanted them to be absolved of that sin. How could that be done? By recreating the same situation and having them respond selflessly, rather than selfishly.
He singled out Benjamin for special attention, just like his father had singled him out for special attention.
But this time the brothers weren't jealous. On the contrary, they were willing to risk their lives for Benjamin's sake. When Joseph saw this, he understood that they had already corrected their flaw. When he saw that they had completed their task of personal refinement, he revealed his identity to them.