Forum Xamarin Test Cloud (Read Only)

Host HTTP Server in app to connect to UITest Client

Hi, I'm referring to the implementation outlined in this video:

This works fine running locally using the IP address of my device over any port (as long as the client and server use the same port).

Test client:

var url = isTestCloud ? Environment.GetEnvironmentVariable("XTC_APP_ENDPOINT") : "http://" + deviceIp + ":8081"; HttpClient client = new HttpClient { BaseAddress = new Uri(url), };

In App:
HttpListener _listener = new HttpListener(); var prefixes = new [] { "http://*:8081/", }; foreach (string s in prefixes) _listener.Prefixes.Add (s); _listener.Start ();

This works great running locally, but when trying to run in Test Cloud, I get a System.TimeoutException in my Test while trying to connect to the game server.

From the video, James makes it clear that you must be listening on 8081, however this was a couple of years ago and I'm wondering if it has changed. I also tried changing 8081 to 37777. But I still had the same result.

I noticed the XTC_APP_ENDPOINT env variable returns something like:

I adjusted my server to use 37777, same result.
I tried again adjusting my prefix: var prefixes = new [] { "http://*:37777/*/token-*/", };, but always get the same result (System.TimeoutException).

Is there any documentation I can read up on regarding how to interact with an embedded HTTP server? Or can someone point me in the right direction?



  • LorenKuichLorenKuich USMember

    I heard back from support yesterday and it seems this was an issue with TestCloud. My original code (using port 8081) now works!


Sign In or Register to comment.