use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class MocoConnectionTest method should_not_keep_alive_for_close_request.
@Test
public void should_not_keep_alive_for_close_request() throws Exception {
server.response("foo");
running(server, new Runnable() {
@Override
public void run() throws Exception {
Response response = Request.Get(root()).addHeader("Connection", "close").execute();
assertThat(response.returnResponse().getFirstHeader("Connection"), nullValue());
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_http_server_with_any_handler_one_side.
@Test
public void should_merge_http_server_with_any_handler_one_side() throws Exception {
HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(helper.get(remoteUrl("/foo/anything")), is("foo"));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_https_server.
@Test
public void should_merge_https_server() throws Exception {
anotherServer = httpsServer(12306, DEFAULT_CERTIFICATE, context("/bar"));
HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(helper.get(remoteHttpsUrl("/foo/anything")), is("foo"));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_config_handler_correctly_other_side_while_merging.
@Test
public void should_config_handler_correctly_other_side_while_merging() throws Exception {
httpServer = httpServer(12306, fileRoot("src/test/resources"));
httpServer.response(file("foo.response"));
HttpServer mergedServer = ((ActualHttpServer) httpServer).mergeServer((ActualHttpServer) anotherServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws IOException {
assertThat(helper.get(root()), is("foo.response"));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_http_server_without_port_for_first_server.
@Test
public void should_merge_http_server_without_port_for_first_server() throws Exception {
httpServer = httpServer(12306, context("/foo"));
anotherServer = httpServer(context("/bar"));
final HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(mergedServer.port(), is(12306));
}
});
}
Aggregations