forked from I2P_Developers/i2p.i2p
Fix test
This commit is contained in:
@@ -817,7 +817,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
* @throws BadRequestException on bad headers
|
* @throws BadRequestException on bad headers
|
||||||
* @throws IOException on other errors in the underlying stream
|
* @throws IOException on other errors in the underlying stream
|
||||||
*/
|
*/
|
||||||
private static Map<String, List<String>> readHeaders(I2PSocket socket, InputStream in, StringBuilder command,
|
static Map<String, List<String>> readHeaders(I2PSocket socket, InputStream in, StringBuilder command,
|
||||||
String[] skipHeaders, I2PAppContext ctx) throws IOException {
|
String[] skipHeaders, I2PAppContext ctx) throws IOException {
|
||||||
HashMap<String, List<String>> headers = new HashMap<String, List<String>>();
|
HashMap<String, List<String>> headers = new HashMap<String, List<String>>();
|
||||||
StringBuilder buf = new StringBuilder(128);
|
StringBuilder buf = new StringBuilder(128);
|
||||||
|
@@ -28,7 +28,7 @@ public class I2PTunnelHTTPServerTest extends TestCase {
|
|||||||
headerString += "BLAH: something\r\n";
|
headerString += "BLAH: something\r\n";
|
||||||
headerString += "\r\n";
|
headerString += "\r\n";
|
||||||
InputStream in = fillInputStream(headerString);
|
InputStream in = fillInputStream(headerString);
|
||||||
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext());
|
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(null, in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext());
|
||||||
assertEquals(headers.size(), 1); //One header
|
assertEquals(headers.size(), 1); //One header
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class I2PTunnelHTTPServerTest extends TestCase {
|
|||||||
headerString += "someHeader: oh my, duplication!\r\n";
|
headerString += "someHeader: oh my, duplication!\r\n";
|
||||||
headerString += "\r\n";
|
headerString += "\r\n";
|
||||||
InputStream in = fillInputStream(headerString);
|
InputStream in = fillInputStream(headerString);
|
||||||
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext());
|
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(null, in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext());
|
||||||
assertEquals(headers.size(), 1);
|
assertEquals(headers.size(), 1);
|
||||||
assertEquals(headers.get("someHeader").size(), 2);
|
assertEquals(headers.get("someHeader").size(), 2);
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ public class I2PTunnelHTTPServerTest extends TestCase {
|
|||||||
headerString += "\r\n";
|
headerString += "\r\n";
|
||||||
InputStream in = fillInputStream(headerString);
|
InputStream in = fillInputStream(headerString);
|
||||||
StringBuilder builder = new StringBuilder(128);
|
StringBuilder builder = new StringBuilder(128);
|
||||||
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(in, builder, new String[0], I2PAppContext.getGlobalContext());
|
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(null, in, builder, new String[0], I2PAppContext.getGlobalContext());
|
||||||
String result = I2PTunnelHTTPServer.formatHeaders(headers, builder);
|
String result = I2PTunnelHTTPServer.formatHeaders(headers, builder);
|
||||||
int first = result.indexOf("abc");
|
int first = result.indexOf("abc");
|
||||||
assertTrue(first >= 0);
|
assertTrue(first >= 0);
|
||||||
|
Reference in New Issue
Block a user