public TcpServerProxyPublisher(TcpClient client, IEventChannel <TResource> channel) { _client = client; _channel = channel; var endpoint = (IPEndPoint)_client.Client.RemoteEndPoint; _clientAddress = new Address(endpoint.Address.ToString(), endpoint.Port); new Thread(() => { while (true) { while (_client.Available == 0) { ; } var stream = _client.GetStream(); var data = Helpers.ReadFromStream(stream); var message = Helpers.FromByteArray <Message>(data); if (message == Message.Unsubscribe) { _channel.UnregisterPublisher(_clientAddress); } } }).Start(); }