fix connection problems when more than one endpoint is available.
fix connection problems when more than one endpoint is available.

Change-Id: Ia7b80bd1b3b4f3300ce935102c2687b05e2ae85d
Reviewed-on: http://gerrit.aldebaran.lan:8080/8300
Reviewed-by: llec <42f1a1c02cacc0f5b0188f0127ea77bedfdcf21a@aldebaran-robotics.com>
Tested-by: fmichea <e20d0674aeea681862835ac59e1fa7c309090652@aldebaran-robotics.com>

aldebaran/libqi,vbarbaresi/libqi,aldebaran/libqi-java,bsautron/libqi,aldebaran/libqi-java,aldebaran/libqi-java,aldebaran/libqi,aldebaran/libqi