org.apache.http.impl.execchain.RequestAbortedException Java Examples

The following examples show how to use org.apache.http.impl.execchain.RequestAbortedException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LambdaContainerHandlerTest.java    From aws-serverless-java-container with Apache License 2.0 6 votes vote down vote up
@Test
public void throwNonRuntime_returnsWrappedException() {
    try {
        isRuntimeException = false;
        throwException = true;
        LambdaContainerHandler.getContainerConfig().setDisableExceptionMapper(true);
        handler.proxy(new AwsProxyRequestBuilder("/test", "GET").build(), new MockLambdaContext());
    } catch (Exception e) {
        assertNotNull(e);
        assertNotNull(e.getCause());
        assertTrue(e.getCause() instanceof RequestAbortedException);
        assertEquals(ExceptionContainerHandlerTest.NON_RUNTIME_MESSAGE, e.getCause().getMessage());
        return;
    }
    fail("Did not throw exception");
}
 
Example #2
Source File: LambdaContainerHandlerTest.java    From aws-serverless-java-container with Apache License 2.0 5 votes vote down vote up
@Override
protected void handleRequest(HttpServletRequest containerRequest, AwsHttpServletResponse containerResponse, Context lambdaContext) throws Exception {
    if (throwException) {
        if (isRuntimeException) {
            throw new RuntimeException(RUNTIME_MESSAGE);
        } else {
            throw new RequestAbortedException(NON_RUNTIME_MESSAGE);
        }
    }
    containerResponse.setStatus(200);
    containerResponse.getWriter().print("OK");
    containerResponse.flushBuffer();
}