static void WriteErrorConnectionResponse(Status status, string message, IStream <byte, byte> stream) { if (status == Status.Ok) { throw new ArgumentException("Error response must have a non-OK status code"); } var response = new ConnectionResponse(); response.Status = status; response.Message = message; Utils.WriteMessage(stream, response); }
static void WriteErrorConnectionResponse(Status status, string message, IStream <byte, byte> stream) { if (status == Status.Ok) { throw new ArgumentException("Error response must have a non-OK status code"); } var response = new ConnectionResponse(); response.Status = status; response.Message = message; Utils.WriteMessage(stream, response); Logger.WriteLine("ProtocolBuffers: client connection denied: " + status + " " + message, Logger.Severity.Error); }
/// <summary> /// Write a connection response message /// </summary> public static void WriteConnectionResponse( IClient <byte, byte> client, Status errorStatus, string errorMessage) { if (errorStatus == Status.Ok) { throw new ArgumentException("Error response must have a non-OK status code"); } var response = new ConnectionResponse(); response.Status = errorStatus; response.Message = errorMessage; WriteMessage(client.Stream, response); }
public static void CheckConnectionResponse(byte[] responseBytes, int expectedLength, Status expectedStatus, string expectedMessage, int expectedIdLength) { Assert.AreEqual(expectedLength, responseBytes.Length); var response = new ConnectionResponse(); var codedResponseStream = new CodedInputStream(responseBytes); codedResponseStream.ReadMessage(response); Assert.AreEqual(expectedStatus, response.Status); Assert.AreEqual(expectedMessage, response.Message); Assert.AreEqual(expectedIdLength, response.ClientIdentifier.Length); }
static void WriteErrorConnectionResponse(IClient <byte, byte> client, Status status, string message) { Utils.WriteConnectionResponse(client, status, message); Logger.WriteLine("ProtocolBuffers: client connection denied: " + status + " " + message, Logger.Severity.Error); }
public static void CheckConnectionResponse(byte[] responseBytes, int expectedLength, Status expectedStatus, string expectedMessage, int expectedIdLength) { KRPC.Test.Server.ProtocolBuffers.TestingTools.CheckConnectionResponse(responseBytes, expectedLength, expectedStatus, expectedMessage, expectedIdLength); }