public void CreateSocketTest() { Context ctx = new Context(); Socket socket = ctx.CreateSocket( SocketType.Publisher ); Assert.IsNotNull( socket ); }
public void ContextConstructorTest1() { Context ctx = new Context(); Assert.IsNotNull( ctx ); Assert.IsFalse( ctx.Disposed ); }
/// <summary> /// Creates a new stream of the specified type for the specified context. /// </summary> /// <param name="context"></param> /// <param name="socketType"></param> /// <param name="lingerTime">Linger period for socket shutdown, in ms, or <see cref="Timeout.Infinite"/> for no linger.</param> protected ZMQStream( Context context, SocketType socketType, int lingerTime = Context.DEFAULT_LINGER ) : base() { Contract.Requires( context != null ); Contract.Requires( lingerTime >= 0 || lingerTime == Timeout.Infinite ); Disposed = false; m_context = context; m_socket = m_context.CreateSocket( socketType ); if( lingerTime >= 0 ) { m_socket.SetOption( SocketOption.Linger, lingerTime ); } }
public void DisposeTest() { Context ctx = new Context(); ctx.Dispose(); Assert.IsTrue( ctx.Disposed ); try { ctx.CreateSocket( SocketType.Publisher ); Assert.Fail( "Disposed Context should not be able to create sockets." ); } catch { } }
static ZMQStream() { defaultContext = new Context(); }