public Server(ISerializer serializer, string serverUri) { _serializer = serializer; _rsa = Rsa.Create(); _sessionCache = new SessionCache(); _socket = new ResponseSocket(); _socket.Bind(serverUri); while (true) { var messageBytes = _socket.ReceiveFrameBytes(); var message = _serializer.Deserialize <SecurityLayerMessage>(messageBytes); switch (message.Type) { case SecurityMessageType.ClientHello: HandleClientHello(message.Data); break; case SecurityMessageType.ClientKeyExchange: HandleClientKeyExchange(message.Data); break; case SecurityMessageType.ApplicationData: HandleApplicationData(message.Data); break; } } }
public Client(ISerializer serializer) { _serializer = serializer; _rsa = Rsa.Create(); _socket = new RequestSocket(); _session = new Session() { IsAuthenticated = false }; }