tomp2p/TomP2P — pull request #52 by nicoruti (2014-10-25 12:41:15+00:00)
Title: Relay for Android devices

Instead of keeping open a TCP connection, the relay uses Google Cloud Messaging (GCM) to notify the mobile device. Requests may take longer to arrive and process at the mobile device. To prevent timeouts, the relay peer already returns a temporary OK to the requester, until the mobile device returns the final response.

This pull requests also includes multiple other fixes to bugs around Rcon and Relay (OpenTCP). The two test cases TestRelay and TestRcon demonstrate that everything should work now. For testing the new Android feature, it's not possible to use GCM without a physical Android phone. Thus, I mocked the GCM sending procedure and am using listeners to inform the relayed peer about updates from the relay.

Minor improvements in the core have also been done (e.g. preventing NPE's or adding documentation). The biggest change is possibly in the PeerAddress, where a 'slow' flag has been added to indicate slow relayed peer (Android). Requesters know therefore that they need to wait for the final answer of the mobile device instead of being happy with the temporary OK from the relay.