AppClient.RegisterClientRequest.Builder registerClientRequestBuilder = null;
try {
registerClientRequestBuilder = me.createDefaultRegisterClientRequest(context, "MobiledgeX-Samples")
.setAppName("EdgeMultiplay")
.setAppVers("1.2");
AppClient.RegisterClientRequest req = registerClientRequestBuilder.build();
AppClient.RegisterClientReply regReply = me.registerClient(req,10000);
AppClient.FindCloudletRequest findCloudletRequest = me.createDefaultFindCloudletRequest(context, location)
.setCarrierName("")
.build();
int internalPort = 7776;
AppClient.FindCloudletReply findCloudletReply = me.findCloudlet(findCloudletRequest, 10000);
String host = me.getAppConnectionManager().getHost(findCloudletReply, internalPort);
int port = me.getAppConnectionManager().getPublicPort(findCloudletReply, internalPort);
Site site =
new Site(context,
NetTest.TestType.CONNECT, 5, host, port);
netTest.addSite(site);
} catch (DmeDnsException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
Assert.assertFalse(String.valueOf(e.getStackTrace()), true);
} catch (NameNotFoundException pmnf) {
Assert.assertTrue("Missing package manager!", false);
}
List<Site> sites = netTest.sortedSiteList();
netTest.testSites(TimeoutMS);
List<Site> sortedSites = netTest.sortedSiteList();
for (Site s : sortedSites) {
Log.i(TAG, "Test average: " + s.average);
}