public void TestDisconnectClient() { Until((port, done) => { var server = new ReverseAsyncSocket(); server.Listen(port, socket => socket.Disconnect()); var count = 2; var client = new ReverseAsyncSocket(); client.Read((id, command, text) => { }); client.Disconnect(() => done(--count == 0)); client.Connect(Host, port, () => client.Disconnect(() => done(--count == 0))); }); }
public static void ReadString(this ReverseAsyncSocket socket, Action <int, Command, string> callback) { socket.Read((id, command, data) => callback(id, command, Encoding.UTF8.GetString(data))); }