The first thing I'd try is spraying your plugs with WD-40 to displace any water. One time I was hauling some horses locally and any time I turned on my turn signal, the brakes would engage- lotsa fun! I unhooked the electrical to the trailer (I had plenty of truck to stop the trailer without trailer brakes) and when I got home I sprayed all the connections with WD40- problem solved.
ETA- Another thing you can try is hooking the trailer to another truck. If everything works, then it's your truck and not the trailer with the problem.
Something in the wiring connection. Could be the plug as shakey tails mentioned, or it could be the wire itself. I had mice chew through a few of my wires, and I had running lights, but no brake lights or brakes. Loads of fun to drive to the repair shop.