Man accused of shooting deputy testifies in retrial