As we all know, Brendon McCullum recorded the fastest ever Test century in the Christchurch Test when he crossed 100 in 54 balls.
He also became the only Test player to score a century in the last test of his career, while captaining his country. This is what you get from Statsguru:

Naturally, Smith can be discounted as we know he has not retired. So McCullum is the only one who qualifies.
This seemed a bit odd, so I repeated this check to identify those who scored a fifty in the last test of their career, while captaining their side. We get this:

This live link may be more useful: http://stats.espncricinfo.com/ci/engine/stats/index.html?captain=1;class=1;debut_or_last=2;filter=advanced;opposition=1;opposition=2;opposition=25;opposition=3;opposition=4;opposition=5;opposition=6;opposition=7;opposition=8;opposition=9;orderby=start;qualmin1=1;qualval1=fifty_plus;team=1;team=2;team=25;team=3;team=4;team=5;team=6;team=7;team=8;team=9;template=results;type=batting
As many as 34 names here. But it includes some whose Test careers are not over, essentially everyone from Mushfiqur Rahim downwards excluding McCullum and now Misbah. So we remove Mushfiqur, Kohli, Mathews, AN Cook and SPD Smith.
So we are left with 29 who scored a fifty in their last Test when they were captaining. In some cases their retirement was known in advance, in other cases they may not have known they were playing their last Test.
McCullum has scored the most runs in the match (170) among these, though a few others have crossed 100 without making a century. The WI player RK Nunes is the only one to score two fifties in this category.
We may as well see the list of all those who scored centuries in the last Test of their career, regardless of captaincy:

This live link may be more useful: http://stats.espncricinfo.com/ci/content/records/282931.html
Here we have a total of 42. We remove current players who are likely to keep playing for a while: Hafeez, Rahane, SE Marsh, Amla, SC Cook, de Kock, Burns and SPD Smith. This leaves 34 who scored centuries in their last Test (unless McCullum makes a comeback). In contrast, 100 players scored 102 centuries on debut (Remember Rowe and Yaseer Hameed).
Naturally our old friends AG Ganteaume and RE Redmond are there, as their first and last Tests were the same. Others who scored centuries on debut and last Tests are Duff (104 & 146), Ponsford (110 & 266), Greg Chappell (108 & 182) and Azharuddin (110 & 102). In case SE Marsh does not play another Test he will also join this club with 141 & 182.
Centuries in their last Test include those by Sandham (325, the first Test triple century) and double centuries by Ponsford, Nurse, Aravinda de Silva (last f-c match) and (strangest of all) night-watchman Gillespie making his only Test century.
CAG Russell is the only one to score centuries in both innings of his last Test. He was the first English player to score centuries in both innings of a Test.