public void BonCodeAJP13ServerConnectionConstructorTest1() { BonCodeAJP13PacketCollection packetsToSend = null; // TODO: Initialize to an appropriate value BonCodeAJP13ServerConnection target = new BonCodeAJP13ServerConnection(packetsToSend); Assert.Inconclusive("TODO: Implement code to verify target"); }
public void RemoveTest() { BonCodeAJP13PacketCollection target = new BonCodeAJP13PacketCollection(); // TODO: Initialize to an appropriate value BonCodeAJP13Packet value = null; // TODO: Initialize to an appropriate value target.Remove(value); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void PrintFlushTest() { BonCodeCallHandler_Accessor target = new BonCodeCallHandler_Accessor(); // TODO: Initialize to an appropriate value BonCodeAJP13PacketCollection flushCollection = null; // TODO: Initialize to an appropriate value target.PrintFlush(flushCollection); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void p_CreateConnectionTest() { BonCodeAJP13ServerConnection_Accessor target = new BonCodeAJP13ServerConnection_Accessor(); // TODO: Initialize to an appropriate value BonCodeAJP13PacketCollection packetsToSend = null; // TODO: Initialize to an appropriate value target.p_CreateConnection(packetsToSend); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void BonCodeAJP13ServerConnectionConstructorTest2() { string server = string.Empty; // TODO: Initialize to an appropriate value int port = 0; // TODO: Initialize to an appropriate value BonCodeAJP13PacketCollection packetsToSend = null; // TODO: Initialize to an appropriate value BonCodeAJP13ServerConnection target = new BonCodeAJP13ServerConnection(server, port, packetsToSend); Assert.Inconclusive("TODO: Implement code to verify target"); }
public void ContainsTest() { BonCodeAJP13PacketCollection target = new BonCodeAJP13PacketCollection(); // TODO: Initialize to an appropriate value BonCodeAJP13Packet value = null; // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = target.Contains(value); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void ItemTest() { BonCodeAJP13PacketCollection target = new BonCodeAJP13PacketCollection(); // TODO: Initialize to an appropriate value int index = 0; // TODO: Initialize to an appropriate value BonCodeAJP13Packet expected = null; // TODO: Initialize to an appropriate value BonCodeAJP13Packet actual; target[index] = expected; actual = target[index]; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void LogPacketsTest() { string fileName = string.Empty; // TODO: Initialize to an appropriate value Mutex loggerMutex = null; // TODO: Initialize to an appropriate value BonCodeAJP13Logger target = new BonCodeAJP13Logger(fileName, loggerMutex); // TODO: Initialize to an appropriate value BonCodeAJP13PacketCollection packets = null; // TODO: Initialize to an appropriate value bool logAllways = false; // TODO: Initialize to an appropriate value int onlyAboveLogLevel = 0; // TODO: Initialize to an appropriate value target.LogPackets(packets, logAllways, onlyAboveLogLevel); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
/// <summary> /// Analyze the provided buffer and returns a collection of packets represented by the buffer /// </summary> public static BonCodeAJP13PacketCollection GetPackets(byte[] Buffer) { BonCodeAJP13PacketCollection AnalyzedResponses = new BonCodeAJP13PacketCollection(); if (Buffer != null) { int start = 0; for (int i = 0; i < Buffer.Length; i++) { if (Buffer[start] == BonCodeAJP13PacketFormat.BONCODEAJP13_PACKET_START) { UInt16 UserDataLength = 0; GetUInt16(Buffer, ref UserDataLength, start + USERDATALENGTH_POS); i = start + UserDataLength + 8; // here we need to truncate the buffer and analyze the packet. if (Buffer[i] == BonCodeAJP13PacketFormat.BONCODEAJP13_PACKET_END) { byte[] NewPacket = new byte[i + 1 - start]; Array.Copy(Buffer, start, NewPacket, 0, i + 1 - start); BonCodeAJP13Packet packet = BonCodeAJP13Packet.GetPacket(NewPacket); if (packet != null) { AnalyzedResponses.Add(packet); } else { return(null); } start = i + 1; } else { return(null); } } else { return(null); } } return(AnalyzedResponses); } else { return(null); } }
//this will be passed in as delegate static void PrintFlush(BonCodeAJP13PacketCollection flushCollection) { foreach (TomcatReturn flushPacket in flushCollection) { //TODO: check by packet type and do different processing before calling flush //TomcatSendHeaders tcsh = new TomcatSendHeaders(); if (flushPacket is TomcatSendHeaders) { TomcatSendHeaders tcsh = (TomcatSendHeaders)flushPacket; NameValueCollection tcHeaders = tcsh.GetHeaders(); for (int i = 0; i < tcHeaders.AllKeys.Length; i++) { Console.WriteLine(tcHeaders[i]); } } else { //generic flush of data string outString = flushPacket.GetUserDataString(); Console.WriteLine(outString); } } }
public void BonCodeAJP13PacketCollectionConstructorTest() { BonCodeAJP13PacketCollection target = new BonCodeAJP13PacketCollection(); Assert.Inconclusive("TODO: Implement code to verify target"); }
/// <summary> /// Function to be passed as delegate to BonCodeAJP13 process /// Will pass packet collection content to user browser and flush /// </summary> void PrintFlush(BonCodeAJP13PacketCollection flushCollection) { p_FlushInProgress = true; string keyName = ""; string keyValue = ""; bool isBinary = false; long contentLength = 0; //only assigned if content is known long transferredBytes = 0; foreach (TomcatReturn flushPacket in flushCollection) { try { //check by packet type and do different processing before calling flush if (flushPacket is TomcatSendHeaders) { TomcatSendHeaders tcshPackage = (TomcatSendHeaders)flushPacket; //get Headers NameValueCollection tomcatHeaders = tcshPackage.GetHeaders(); //iterate through headers and set for (int i = 0; i < tomcatHeaders.AllKeys.Length; i++) { keyName = tomcatHeaders.AllKeys[i]; keyValue = tomcatHeaders[keyName]; //check for repeated headers of the same type they are seperated by pipe+comma combination string[] sHeaders = keyValue.Split(new string[] { "|," }, StringSplitOptions.None); string tempValue = ""; if (sHeaders.Length > 1) { //check for multiple headers of same type returned, e.g. cookies for (int i2 = 0; i2 < sHeaders.Length; i2++) { if (i2 == sHeaders.Length - 1) { tempValue = sHeaders[i2].Substring(0, sHeaders[i2].Length - 1); //last array element } else { tempValue = sHeaders[i2]; //regular array element } p_Context.Response.AddHeader(keyName, tempValue); } } else { //single header remove pipe character at the end tempValue = keyValue.Substring(0, keyValue.Length - 1); p_Context.Response.AddHeader(keyName, tempValue); } //check for binary or text disposition if (!isBinary && (keyName == "Content-Type" || keyName == "Content-Encoding")) { //set encoding seperatly if needed if (keyName == "Content-Encoding" && (tempValue.Contains("gzip") || tempValue.Contains("deflate"))) { isBinary = true; } else { isBinary = TestBinary(keyValue); } } //check for known content length if (keyName == "Content-Length") { try { contentLength = System.Convert.ToInt64(tempValue); } catch (Exception) { contentLength = 0; }; } //check whether we can represent a given header in native IIS Response context IISNativeHeaders(keyName, tempValue); } //set response status code p_Context.Response.StatusCode = tcshPackage.GetStatus(); } else if (flushPacket is TomcatEndResponse) { //if this is the last package and we know the content length we need to write empty strings //this is a fix if content-length is misrepresented by tomcat if (contentLength > 0 && transferredBytes < contentLength) { string fillEmpty = new string(' ', System.Convert.ToInt32(contentLength - transferredBytes)); p_Context.Response.Write(fillEmpty); } } else if (flushPacket is TomcatSendBodyChunk) { transferredBytes = transferredBytes + flushPacket.GetUserDataBytes().Length; p_Context.Response.BinaryWrite(flushPacket.GetUserDataBytes()); } } catch (Exception) { //TODO: add exception handler logging p_Context.Response.Write("Error in transfer of data from tomcat to browser."); } } //loop over packets //attempt to flush now try { p_Context.Response.Flush(); } catch (Exception) { //do nothing. Mostly this occurs if the browser already closed connection with server or headers were already transferred bool errFlag = true; } p_FlushInProgress = false; } //end print flush