This depends on the gateway..
If you yourself are connecting via the same gateway in order to connect to the Internet, your sockets should do the same.
However, if your trying to make your sockbot connect via a seperate gateway all together, then you will need to learn the protocol of such a gateway, whether it be HTTP or SOCK and "mimic" the commands sent to it, try a
google search for the protocol.
Personally i've *never* seen a use for a sockbot connecting via a gateway other than for the purpose of flooding, primarily because a sockbot isnt intended to be "perminent" and as result wouldnt be viable as a channel bot, or any other realistic use.
Except for perhaps gathering "statistics" from alternative networks, in which case you wouldnt need a gateway to hide your ip since the bot wouldnt be joining any channels.
Eamonn.