aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-08-30 10:08:18 (EDT)
committerThomas Becker2013-08-30 11:21:59 (EDT)
commit669ee7572006943e779daeeb6c91f930441ebae4 (patch)
tree8add578e30608ff22bc8194f939acd12403419fc
parent566065dd34c9a5ba200bb02828e42145f110de6c (diff)
downloadorg.eclipse.jetty.project-669ee7572006943e779daeeb6c91f930441ebae4.zip
org.eclipse.jetty.project-669ee7572006943e779daeeb6c91f930441ebae4.tar.gz
org.eclipse.jetty.project-669ee7572006943e779daeeb6c91f930441ebae4.tar.bz2
415548 migrate ProxyHTTPToSPDYTest to use HttpClient to avoid intermittent NPE part 2
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPToSPDYTest.java46
1 files changed, 4 insertions, 42 deletions
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPToSPDYTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPToSPDYTest.java
index 634e206..5368ba7 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPToSPDYTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPToSPDYTest.java
@@ -18,12 +18,7 @@
package org.eclipse.jetty.spdy.server.proxy;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
import java.net.InetSocketAddress;
-import java.net.Socket;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
@@ -399,27 +394,8 @@ public class ProxyHTTPToSPDYTest
}
}));
- Socket client = new Socket();
- client.connect(proxyAddress);
- OutputStream output = client.getOutputStream();
-
- String request = "" +
- "GET / HTTP/1.1\r\n" +
- "Host: localhost:" + proxyAddress.getPort() + "\r\n" +
- "\r\n";
- output.write(request.getBytes("UTF-8"));
- output.flush();
-
- client.setSoTimeout(1000);
- InputStream input = client.getInputStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8"));
- String line = reader.readLine();
- Assert.assertTrue(line.contains(" 200"));
- while (line.length() > 0)
- line = reader.readLine();
- Assert.assertFalse(reader.ready());
-
- client.close();
+ ContentResponse response = httpClient.newRequest("localhost", proxyAddress.getPort()).method(HttpMethod.GET).send();
+ assertThat("response code is 200 OK", response.getStatus(), is(200));
}
@Test
@@ -440,21 +416,7 @@ public class ProxyHTTPToSPDYTest
}
}));
- Socket client = new Socket();
- client.connect(proxyAddress);
- OutputStream output = client.getOutputStream();
-
- String request = "" +
- "GET / HTTP/1.1\r\n" +
- "Host: localhost:" + proxyAddress.getPort() + "\r\n" +
- "\r\n";
- output.write(request.getBytes("UTF-8"));
- output.flush();
-
- InputStream input = client.getInputStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8"));
- Assert.assertNull(reader.readLine());
-
- client.close();
+ ContentResponse response = httpClient.newRequest("localhost", proxyAddress.getPort()).method(HttpMethod.GET).send();
+ assertThat("response code is 500 OK", response.getStatus(), is(500));
}
}