SSL Pinning on Android

I had to do SSL Pinning on Android today. What a fucking mess.

Most of the posts I read on how to do it used libraries like okhttp. But the app I'm working on has its own networking stack, so I had to find a solution that could be adapted.

Fortunately, I found this, which made me really happy.