Initially Torres seems ignorant of the possible danger that awaits him. However,at the end of the story, he reveals otherwise. Why,then, does he go to the barber's?
Torres was never ignorant of his situation. He lets you know that at the end of the story when he says,
"They told me you'd kill me. I came to find out. But killing isn't easy. You can take my word for it." (last line of story)
He purposely went to that barber shop. Torres was the Captain of the town, and he had to deal with rebels among the people. However, to talk about killing someone and actually killing them are two different things.
Torres actually taunts the barber to see how far he can push him. Torres has captured fourteen of the rebels, and he knows that the barber is sympathetic toward them. It can be inferred that his spies have been watching people in the town to see who is sympathetic, otherwise they would not have warned him to stay away from the barber shop. So he tells the barber,
"Not one of them comes out of this alive, not one"
He also tells the barber that he is tired and
"....I could go straight to sleep"
Torres does show that he is nervous because he would not stop talking. The barber actually comments on that. However, Torres is either a very brave or very stupid man for doing what he did. The barber wouldn't have lived long, but it would have been so easy for him to slice the Captain's throat. Torres was also aware that it takes a certain kind of man to kill and be cruel.