Code samples from BitTorrent client case study chapter