public StreamStuff(IAPIFactory <INngMsg> factory) { var url = UrlIpc(); laio = factory.CreateAio().Unwrap(); daio = factory.CreateAio().Unwrap(); listener = factory.StreamListenerCreate(url).Unwrap(); dialer = factory.StreamDialerCreate(url).Unwrap(); laio.SetTimeout(Util.DelayShortMs); daio.SetTimeout(Util.DelayShortMs); listener.Listen().Unwrap(); listener.Accept(laio); dialer.Dial(daio); laio.Wait(); daio.Wait(); // Connected nng_stream is stored as aio output 0 and shouldn't be NULL Assert.NotEqual(IntPtr.Zero, laio.GetOutput(0)); Assert.NotEqual(IntPtr.Zero, daio.GetOutput(0)); lstream = factory.StreamFrom(laio).Unwrap(); dstream = factory.StreamFrom(daio).Unwrap(); }
public void Basic() { Util.RepeatTest(() => { var callbacks = new AioCallback[] { null, staticAioCallback, }; foreach (var callback in callbacks) { using (var aio = factory.CreateAio(callback).Unwrap()) { aio.SetTimeout(10); aio.Wait(); aio.GetResult().Unwrap(); Assert.Equal(IntPtr.Zero, aio.GetOutput(0)); aio.Cancel(); } } }); }