public void ShutdownWithNoStartup() { ServerTester creator = new ServerTester(); using (var svr = creator.Invoke().Server) { creator.Stop(); creator.CheckExecutorsUnstarted(); } }
public void ShutdownTest() { ServerTester creator = new ServerTester(); using (var svr = creator.Invoke().Server) { creator.Start(); creator.Stop(); creator.CheckExecutorsTerminated(); } }
public LndMockTester(ServerTester serverTester, string environmentName, string defaultValue, string defaultHost, Network network) { this._Parent = serverTester; var url = serverTester.GetEnvironment(environmentName, defaultValue); Swagger = new LndSwaggerClient(new LndRestSettings(new Uri(url)) { AllowInsecure = true }); Client = new LndClient(Swagger, network); P2PHost = _Parent.GetEnvironment(environmentName + "_HOST", defaultHost); }
public void SslServerMessagePassingTest() { ServerTester.PlayCommonServerTest(new SslTestServer("0.0.0.0", PortProvider.ProviderPort()), delegate(TestClient.Builder builder) { builder.SslEnabled(true); }); }
public void ClientToServerMessagePassingTest() { ServerTester.PlayCommonServerTest(new ServerTester.TestServer("0.0.0.0", PortProvider.ProviderPort())); }
async Task TestConnectionToServerAsync(string serverHostname, int serverPort, int versionCode) { var shouldRetry = false; IPAddress serverIPAddress = null; #region Lookup Hostname try { // Resolve the hostname via DNS serverIPAddress = ResolveHostname(serverHostname); Debug.WriteLine(string.Format("Resolved '{0}' -> {1}", serverHostname, serverIPAddress)); // An error occured when trying to resolve the hostname to an IPv4 address if (serverIPAddress == null) { Debug.WriteLine(string.Format("NoIPv4AddressFoundForHost: {0}", serverHostname)); this.DialogService.ShowOKDialog("Unable to Resolve Hostname", "Unable to resolve the server hostname to an IPv4 address.", "Check your network connection and try again."); return; } } catch (Exception ex) { // An error occured when trying to resolve the hostname Debug.WriteLine(string.Format("UnableToResolveHostname: {0}", ex.Message)); this.DialogService.ShowOKDialog("Unable to Resolve Hostname", "Unable to resolve the server hostname.", "Check your network connection and try again."); return; } #endregion try { using (var serverTester = new ServerTester()) { await serverTester.ConnectToServerAsync(serverIPAddress, serverPort); var isVersionOK = await serverTester.CheckClientVersionCodeAsync(versionCode); Debug.WriteLine(string.Format("CheckClientVersionOK: {0}", isVersionOK)); if (isVersionOK) { // The server has accepted this client version this.DialogService.ShowOKDialog("Connection Successful", "The server appears to be up and running.", string.Format("Connected to {0}:{1} successfully.", serverIPAddress, serverPort)); } else { // This server has rejected this client version this.DialogService.ShowOKDialog("Connection Failed", "The server appears to be running, but requires a different version of the client.", null); } } } catch (Exception ex) { // An error occured when trying to connect to the hostname Debug.WriteLine(string.Format("UnableToConnect: {0}", ex.Message)); var result = this.DialogService.ShowYesNoDialog("Connection Failed", "Unable to connect to the server.", ex.Message, yesButtonTitle: "T_ry Again", noButtonTitle: "_OK"); // Retry the connection if (result.HasValue && result.Value) { shouldRetry = true; } } if (shouldRetry) { await TestConnectionToServerAsync(serverHostname, serverPort, versionCode); } }