Former Ireland captain Trent Johnston is to retire from international cricket at the end of the year.