Yes, some droids could. There was special hardware called "Pain-simulator button" to achieve that.
That specific scene from ROTJ that you linked to was expanded in EU/Legends book "Tales from Jabba's Palace" novelette "A Bad Feeling: The Tale of EV-9D9" Judith and Garfield Reeves-Stevens.
Ignoring for the moment the Gamorrean guard and the new prisoners {{of course, those prisoners were R2-D2 and C-3PO - DVK's note}}, Ninedenine racked up the gain on her internal receptors, savoring the intensity of it all. She concentrated her meta-analytical functions on the high-frequency carrier wave generated by the pain-simulator button newly connected to the GNK’s central circuits. That signal was … delicious.
Simply put, and Ninedenine did cherish simplicity, she knew that what she did was an act of creation—an art form. Though trying to explain to an organic that a droid such as she could appreciate art was like trying to explain that a droid could feel pain.
Droids could feel pain, of course. One of the two new prisoners coming her way was proof of that—a golden protocol droid from the looks of it, buffed to a courtly gleam, completely out of place in this warren of dank tunnels, decaying power conduits, and scurrying, fur-covered, organic scavengers.
The text further explains why she was sure C-3PO could feel pain:
“Disintegrated …?” the golden droid repeated, trying to make sense of what was going on. Ninedenine wondered if it too had picked up the pain transmission from the dismembered droid, and was experiencing the first touch of disturbance. Pain-simulator buttons were supposedly restricted technology, typically installed only in those droids who had to interact with organics at the most personal level. Strike a protocol droid on the head, for instance, and it would respond that the blow had hurt. Such empathy toward potentially damaging physical sensation was supposed to give them deeper understanding of organics. But as far as Ninedenine was concerned, it just made protocol droids better subjects for her experiments.