Example #1
0
        /// <summary>Initializes a new instance of the SocketTestContext class.</summary>
        public PeerTestContext()
        {
            AcceptedPeers = new List<Peer>();
            ClientPeers = new List<Peer>();
            Packets = new List<object>();

            Peer = new Peer(new TestProtocol());
            Peer.PacketReceived += OnPacketReceived;

            Listener = new Listener(new TestProtocol());
            Listener.PeerConnected += OnPeerAccepted;
        }
Example #2
0
 /// <summary>Creates new socket.</summary>
 /// <returns>New socket.</returns>
 public Peer NewSocket()
 {
     var np = new Peer(new TestProtocol());
     ClientPeers.Add(np);
     return np;
 }
Example #3
0
 /// <summary>Initializes a new instance of the PeerEventArgs class using the specified peer and packet.</summary>
 /// <param name="peer">Peer.</param>
 /// <param name="packet">Packet.</param>
 internal PeerEventArgs(Peer peer, object packet)
 {
     Peer = peer;
     Packet = packet;
 }
Example #4
0
 /// <summary>Initializes a new instance of the PeerEventArgs class using the specified peer and connection state.</summary>
 /// <param name="peer">Peer.</param>
 /// <param name="connectionState">Socket connection state.</param>
 internal PeerEventArgs(Peer peer, ConnectionState connectionState)
 {
     Peer = peer;
     ConnectionState = connectionState;
 }