~ubuntu-branches/ubuntu/vivid/httpcomponents-core/vivid

« back to all changes in this revision

Viewing changes to httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2014-10-25 23:01:10 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20141025230110-lhr341pbqk6l2loc
Tags: 4.3.3-1
* New upstream release
* Ignore the apache-rat-plugin
* Standards-Version updated to 3.9.6 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
    @Test
102
102
    public void testClosed() throws Exception {
103
103
        final State state = new HttpAsyncRequestExecutor.State();
104
 
        state.setRequestState(MessageState.COMPLETED);
105
 
        state.setResponseState(MessageState.COMPLETED);
 
104
        state.setRequestState(MessageState.READY);
 
105
        state.setResponseState(MessageState.READY);
106
106
        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
107
107
        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
108
108
 
109
109
        this.protocolHandler.closed(this.conn);
110
110
 
111
 
        Assert.assertEquals(MessageState.READY, state.getRequestState());
112
 
        Assert.assertEquals(MessageState.READY, state.getResponseState());
113
111
        Mockito.verify(this.exchangeHandler, Mockito.never()).close();
114
112
    }
115
113
 
123
121
    }
124
122
 
125
123
    @Test
 
124
    public void testClosedInconsistentState() throws Exception {
 
125
        final State state = new HttpAsyncRequestExecutor.State();
 
126
        state.setRequestState(MessageState.COMPLETED);
 
127
        state.setResponseState(MessageState.INIT);
 
128
        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
 
129
        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
 
130
 
 
131
        this.protocolHandler.closed(this.conn);
 
132
 
 
133
        Mockito.verify(this.exchangeHandler).failed(Mockito.any(ConnectionClosedException.class));
 
134
    }
 
135
 
 
136
    @Test
126
137
    public void testHttpExceptionHandling() throws Exception {
127
138
        final State state = new HttpAsyncRequestExecutor.State();
128
139
        state.setRequestState(MessageState.COMPLETED);