public void setUp() throws Exception {
initServer();
this.serverHttpProc = new ImmutableHttpProcessor(
new ResponseServer("TEST-SERVER/1.1"), new ResponseContent(), new ResponseConnControl());
final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
registry.register("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
@Override
public void handle(
final HttpRequest request,
final HttpResponse response,
final HttpContext context) throws HttpException, IOException {
final String content = "thank you very much";
final NStringEntity entity = new NStringEntity(content, ContentType.DEFAULT_TEXT);
response.setEntity(entity);
}
}));
registry.register("/goodbye", new BasicAsyncRequestHandler(new HttpRequestHandler() {
@Override
public void handle(
final HttpRequest request,
final HttpResponse response,
final HttpContext context) throws HttpException, IOException {
final String content = "and goodbye";
final NStringEntity entity = new NStringEntity(content, ContentType.DEFAULT_TEXT);
response.setEntity(entity);
response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
}
}));
registry.register("/echo", new BasicAsyncRequestHandler(new HttpRequestHandler() {
@Override
public void handle(
final HttpRequest request,
final HttpResponse response,