In general, however, the answer to your question is to use a CCDT and use the JDNI Properties that specify the CCDT for your QCF rather than setting hostname, qm name and port.
I have a standalone Java JMS application sending messages to WebSphere MQ. It uses the WMQInitialContextFactory class and the only way I have been able to get it to communicate with WebSphere over SS ...