There's a sample called EMP-Connector which is used to show the streaming API working. I pulled it from github (forcedotcom/EMP-Connector) and compile it. But it fails to get past the login for me. It hangs on a POST request (LoginHelper.java:123) and never returns. The default login endpoint was https://login.salesforce.com and I have tried changing that to https://test.salesforce.com and other variations but it always hangs.
I also built a SOAP client to check my user/password etc. That works for me, but with the same user/password/securitytoken the EMP-Connector hangs, and I really want to use the streaming API.
The SOAP Client uses a different URL to log in: services/Soap/c/38.0/0DFN0000000CbeW and the one in the EMP-Connector uses services/Soap/u/22.0/ but changing the EMP Connector URL to look more like the SOAP Client URL didn't help, it still hangs.
Does anyone know why this thing hangs?