USB does not use RS232.
It is possible that you have an RS232 to USB adapter. Those adapters do not carry the actual RS232 signals. Instead, when polled for data by the USB master device, they respond with a packet of response, the first byte or two of which is a digital representation of the state of the signals ("on" or "off", 1 or 0), and the rest of which is data. The USB master device receives the data, and sets the pin statuses appropriately in a virtual serial status port, and puts the bytes into a buffer to be read. The actual state of the signals at the RS232 end cannot be measured on the host; it can just see the digital status of the pins as of the time the reading was taken.
In RS232, it is not possible to determine whether pin 2 (transmit) and pin 3 (receive) have been shorted. Data goes out on pin 2, data gets received on pin 3, and the device cannot tell that this is the result of a short and not the result of that particular data happening to be received right then.
Therefore the closest you could get would be to display everything you get on the (virtual) serial input, and not have the receive tied to transmit except when you want it to be. However you do need to be careful to tie the receive to ground when you do not have it shorted to transmit: if you leave it floating then because signal presence is determined by difference between receive and ground, a floating receive pin can have phantom input.
The easiest way to do all of this is to look for the existing code in the File Exchange.