use of org.springframework.http.server.ServerHttpAsyncRequestControl in project spring-framework by spring-projects.
the class AbstractHttpSockJsSession method resetRequest.
protected void resetRequest() {
synchronized (this.responseLock) {
ServerHttpAsyncRequestControl control = this.asyncRequestControl;
this.asyncRequestControl = null;
this.readyToSend = false;
this.response = null;
updateLastActiveTime();
if (control != null && !control.isCompleted()) {
if (control.isStarted()) {
try {
control.complete();
} catch (Throwable ex) {
// Could be part of normal workflow (e.g. browser tab closed)
logger.debug("Failed to complete request: " + ex.getMessage());
}
}
}
}
}
use of org.springframework.http.server.ServerHttpAsyncRequestControl in project spring-boot by spring-projects.
the class HttpTunnelServerTests method httpConnectionAsync.
@Test
public void httpConnectionAsync() throws Exception {
ServerHttpAsyncRequestControl async = mock(ServerHttpAsyncRequestControl.class);
ServerHttpRequest request = mock(ServerHttpRequest.class);
given(request.getAsyncRequestControl(this.response)).willReturn(async);
HttpConnection connection = new HttpConnection(request, this.response);
connection.waitForResponse();
verify(async).start();
connection.respond(HttpStatus.NO_CONTENT);
verify(async).complete();
}
Aggregations