JTest hijacks URLConnection so it is impossible to build integration tests

I was very hopeful that I could use the SnapLogic JTest framework to build actual integration tests for my custom snap pack. Unfortunately, JTest is mocking the URLConnection in such a way where my custom snaps’ SOAP calls are failing. Sigh…

[ERROR] getUserID_ReturnsExpectedValue(com.tylertech.courtsandjustice.snaplogic.OdysseyApiExecutionSyncXmlTest) Time elapsed: 0.059 s <<< ERROR!
com.snaplogic.api.ConfigurationException:
Getting Odyssey Release Level from Odyssey Site QA-2018-2-MEREADY failed: Failed to call SOAP service: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed
com.snaplogic.api.ExecutionException: Failed to call SOAP service: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed
at com.tylertech.courtsandjustice.snaplogic.OdysseyApiExecutionSyncXmlTest.getUserID_ReturnsExpectedValue(OdysseyApiExecutionSyncXmlTest.java:33)
Caused by: com.snaplogic.api.ExecutionException: Failed to call SOAP service: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed
at com.tylertech.courtsandjustice.snaplogic.OdysseyApiExecutionSyncXmlTest.getUserID_ReturnsExpectedValue(OdysseyApiExecutionSyncXmlTest.java:33)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed
at com.tylertech.courtsandjustice.snaplogic.OdysseyApiExecutionSyncXmlTest.getUserID_ReturnsExpectedValue(OdysseyApiExecutionSyncXmlTest.java:33)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed
at com.tylertech.courtsandjustice.snaplogic.OdysseyApiExecutionSyncXmlTest.getUserID_ReturnsExpectedValue(OdysseyApiExecutionSyncXmlTest.java:33)
Caused by: java.lang.ClassCastException: com.snaplogic.snap.test.harness.UrlStreamFactoryImpl$MockUrlConnection cannot be cast to java.net.HttpURLConnection
at com.tylertech.courtsandjustice.snaplogic.OdysseyApiExecutionSyncXmlTest.getUserID_ReturnsExpectedValue(OdysseyApiExecutionSyncXmlTest.java:33)