HttpContext context = new BasicHttpContext();
HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
InputStream instream = Mockito.mock(InputStream.class);
InputStreamEntity entity = new InputStreamEntity(instream, -1);
request.setEntity(entity);
Mockito.when(conn.receiveRequestHeader()).thenReturn(request);
HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 100, "Continue");
Mockito.when(responseFactory.newHttpResponse(HttpVersion.HTTP_1_1, 100, context)).thenReturn(response);