use of com.yahoo.search.StupidSingleThreadedHttpServer in project vespa by vespa-engine.
the class HttpPostTestCase method testPostingSearcher.
@Test
public void testPostingSearcher() throws Exception {
StupidSingleThreadedHttpServer server = new StupidSingleThreadedHttpServer();
server.start();
TestPostSearcher searcher = new TestPostSearcher(new ComponentId("foo:1"), Arrays.asList(new Connection("localhost", server.getServerPort())), "/");
Query q = new Query("");
q.setTimeout(10000000L);
Execution e = new Execution(searcher, Execution.Context.createContextStub());
searcher.search(q, e);
assertThat(server.getRequest(), containsString("My POST body"));
server.stop();
}
use of com.yahoo.search.StupidSingleThreadedHttpServer in project vespa by vespa-engine.
the class HttpTestCase method setUp.
@Override
public void setUp() throws Exception {
httpServer = new StupidSingleThreadedHttpServer(0, 0) {
@Override
protected byte[] getResponse(String request) {
return Utf8.toBytes("HTTP/1.1 200 OK\r\n" + "Content-Type: text/xml; charset=UTF-8\r\n" + "Connection: close\r\n" + "Content-Length: 5\r\n" + "\r\n" + "hello");
}
};
httpServer.start();
}
Aggregations