public void OnDataReceived(Session session, byte[] data) { var received = SerializeManager.Current.Deserialize(data); if (received is DuplexRequest request) { CreateResponse(session, request); } else if (received is DuplexResponse response) { ResolveResponse(response); } else { _CommunicationBase.OnException( session, new ApplicationException("unknown request"), disconnect: false); } }