public MockEndpoint(MockMessagePump pump, MockStack stack, EndPoint myAddress) { Outbox = this; Pump = pump; Stack = stack; Matcher = new Matcher(CoapConfig.Default); Matcher.Start(); MyAddress = myAddress; Session = new MockSession(); }
public MockMessagePump(Type[] layers, ICoapConfig configClient = null, ICoapConfig configServer = null) { if (configClient == null) { configClient = CoapConfig.Default; } if (configServer == null) { configServer = CoapConfig.Default; } ClientStack = new MockStack(layers, configClient) { StackName = "Client" }; MockStack stack = new MockStack(layers, configServer) { StackName = "Server #1" }; ServerStacks.Add(ServerAddress, new List <MockStack>() { stack }); stack.MyEndPoint = new MockEndpoint(this, stack, ServerAddress); ServerStacks.Add(MulticastAddress, new List <MockStack>() { stack }); MockDeliverer serverDeliverer = new MockDeliverer() { IsServer = true, Pump = this }; stack.MyEndPoint.MessageDeliverer = serverDeliverer; stack = new MockStack(layers, configServer) { StackName = "Server #2" }; ServerStacks.Add(ServerAddress2, new List <MockStack>() { stack }); stack.MyEndPoint = new MockEndpoint(this, stack, ServerAddress2); ServerStacks[MulticastAddress].Add(stack); serverDeliverer = new MockDeliverer() { IsServer = true, Pump = this }; stack.MyEndPoint.MessageDeliverer = serverDeliverer; ClientEndpoint = new MockEndpoint(this, ClientStack, ClientAddress); ClientDeliverer = new MockDeliverer() { IsServer = false, Pump = this }; ClientEndpoint.MessageDeliverer = ClientDeliverer; }