aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_http_service
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-03-03 12:18:54 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-03-03 16:01:38 +0100
commit12bce6d56011a44f1c55b72353d10f7ab5e52437 (patch)
treec7404a1f373cbdb8f03fd2b8145113b4966c48ad /jdisc_http_service
parent970ddad95a44f53f2ab44f35533e97586d10f3e5 (diff)
Remove unused raw() and exceptTrailer() methods
Diffstat (limited to 'jdisc_http_service')
-rw-r--r--jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/SimpleHttpClient.java47
1 files changed, 0 insertions, 47 deletions
diff --git a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/SimpleHttpClient.java b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/SimpleHttpClient.java
index 5b5ea27ec19..901c8567121 100644
--- a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/SimpleHttpClient.java
+++ b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/SimpleHttpClient.java
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
-import com.yahoo.jdisc.http.HttpHeaders;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -27,16 +26,10 @@ import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import javax.net.ssl.SSLContext;
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.net.Socket;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
-import java.util.regex.Pattern;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
@@ -102,42 +95,6 @@ public class SimpleHttpClient implements AutoCloseable {
return newGet(path).execute();
}
- public String raw(final String request) throws IOException {
- final Socket socket = new Socket("localhost", listenPort);
- final OutputStreamWriter out = new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8);
- out.write(request);
- out.flush();
-
- final ByteArrayOutputStream buf = new ByteArrayOutputStream();
- final InputStream in = socket.getInputStream();
- final int[] TERMINATOR = { '\r', '\n', '\r', '\n' };
- for (int pos = 0; pos < TERMINATOR.length; ++pos) {
- final int b = in.read();
- if (b < 0) {
- throw new EOFException();
- }
- if (b != TERMINATOR[pos]) {
- pos = -1;
- }
- buf.write(b);
- }
- final String response = buf.toString(StandardCharsets.UTF_8.name());
- final java.util.regex.Matcher matcher = Pattern.compile(HttpHeaders.Names.CONTENT_LENGTH + ": (.+)\r\n").matcher(response);
- if (matcher.find()) {
- final int len = Integer.valueOf(matcher.group(1));
- for (int i = 0; i < len; ++i) {
- final int b = in.read();
- if (b < 0) {
- throw new EOFException();
- }
- buf.write(b);
- }
- }
-
- socket.close();
- return buf.toString(StandardCharsets.UTF_8.name());
- }
-
@Override
public void close() throws IOException {
delegate.close();
@@ -227,9 +184,5 @@ public class SimpleHttpClient implements AutoCloseable {
return this;
}
- public ResponseValidator expectTrailer(final String trailerName, final Matcher<String> matcher) {
- // TODO: check trailer, not header
- return expectHeader(trailerName, matcher);
- }
}
}