private void Connect() { if (client == null || !client.IsConnected) { string[] parts = txtHost.Text.Split(':'); string ip = parts[0]; ushort port = 5000; if (parts.Length == 2 && !string.IsNullOrEmpty(parts[1]) && ushort.TryParse(parts[1], out ushort tmpPort)) { port = tmpPort; } client?.Disconnect(); client = new PlainClient(this) { EnableLogging = true }; client.OnConnected += Client_OnConnectedChanged; client.OnDisconnected += Client_OnConnectedChanged; client.OnMessageReceived += Client_OnMessageReceived; txtHost.Enabled = false; host = $"{ip}:{port}"; AddMessage("[CLIENT] Connecting to the Server @ " + host + "..."); rtbMessages.Show(); ChangeStatus("Connecting to " + host + "..."); client.Connect(ip, port); } }
public void HasInitialResponse() { var request = new SaslPlainRequest(AuthId, Password); var client = new PlainClient(request); Assert.True(client.HasInitialResponse); }
public void CreatesChallengeProperly() { var request = new SaslPlainRequest(AuthId, Password); var client = new PlainClient(request); var result = client.EvaluateChallenge(Array.Empty <byte>()); Assert.Equal(ExpectedResponse, result); }
public void SmokeTest() { var client = new PlainClient(AuthorizationId, Username, Password); var server = new PlainServer(_ => new PlainUser(Username, Password)); var state = GenericTest(client, server); Assert.AreEqual(AuthenticationState.Accepted, state); }
public void PopulatePlainIndexPerson() { for (var i = 20; i < 40; i++) { var index = i + 1; var person = new Person { Id = index, Name = string.Format("Person {0}", index), Revenue = index * 100000, Comment = string.Format("comment {0}", index) }; var personJson = Serializer.ToJson(person); var result = PlainClient.Put(new IndexCommand(Constants.INDEX_PERSON, "person", id: index.ToString()), personJson); } }
public PeerConnectionClient(ServerDetails sd) { this.sd = sd; this.ps = new PlainClient(sd.GetIPEndPoint()); }