I may have found a bug.
Code used is...
onvifCamera = new OnvifDevice("192.168.1.50:80", "user", "password");
some lines of code removed...
rtspUri = onvifCamera.getMedia().getRTSPStreamUri(profileToken);
This returns the following:
rtsp://192.168.1.50:80:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
Note the double port numbers which my guess is because I specified a port when creating the onvifdevice.
If I remove the extra port the url does work ie
rtsp://192.168.1.50:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
Using this version Jar
https://github.com/milg0/onvif-java-lib/blob/master/release/onvif-2016-03-16.jar