Simulations of gamma-ray burst afterglows with a relativistic kinetic code