Ejemplo n.º 1
0
 public void Start(IAdminPortTcpClient client)
 {
     if (timer.Enabled && this.client != client)
     {
         throw new AdminPortException("You cannot start timer with different instance of client when it is running!");
     }
     if (!timer.Enabled)
     {
         this.client             = client;
         client.MessageReceived += OnMessageReceived;
         lastPingReceived        = true;
         timer.Start();
     }
 }
Ejemplo n.º 2
0
        private void Init(IAdminPortTcpClient adminPortTcpClient)
        {
            adminPortTcpClient.MessageReceived += AdminPortTcpClient_MessageReceived;
            adminPortTcpClient.Errored         += AdminPortTcpClient_Errored;
            Context.StateChanged += Context_StateChanged;

            this.StateRunners[AdminConnectionState.Idle]          = new AdminPortIdleState();
            this.StateRunners[AdminConnectionState.Connecting]    = new AdminPortConnectingState();
            this.StateRunners[AdminConnectionState.Disconnecting] = new AdminPortDisconnectingState();
            this.StateRunners[AdminConnectionState.Connected]     = new AdminPortConnectedState();
            this.StateRunners[AdminConnectionState.Errored]       = new AdminPortErroredState();
            this.StateRunners[AdminConnectionState.ErroredOut]    = new AdminPortErroredOutState();

            logger?.LogInformation($"{ServerInfo} Admin Port Client Initialized.");
        }
Ejemplo n.º 3
0
 internal AdminPortClient(IAdminPortTcpClient adminPortTcpClient, IAdminEventFactory eventFactory, ServerInfo serverInfo)
 {
     Context           = new AdminPortClientContext(adminPortTcpClient, "AdminPort", "1.0.0", serverInfo);
     this.eventFactory = eventFactory;
     Init(adminPortTcpClient);
 }
Ejemplo n.º 4
0
 public AdminPortTcpClientShould()
 {
     client = new AdminPortTcpClient(senderMock.Object, receiverMock.Object, tcpClientMock.Object);
 }