HttpResponse error = new BasicHttpResponse(HttpVersion.HTTP_1_0, 500, "Oppsie");
Mockito.when(responseFactory.newHttpResponse(HttpVersion.HTTP_1_0, 500, context)).thenReturn(error);
Mockito.when(handlerResolver.lookup("/")).thenReturn(requestHandler);
Mockito.doThrow(new ProtocolException("oh, this world is wrong")).when(
requestHandler).handle(request, response, context);
Mockito.when(connReuseStrategy.keepAlive(error, context)).thenReturn(false);
httpservice.handleRequest(conn, context);
Assert.assertSame(conn, context.getAttribute(ExecutionContext.HTTP_CONNECTION));
Assert.assertSame(request, context.getAttribute(ExecutionContext.HTTP_REQUEST));