use of io.servicetalk.http.api.HttpConnectionContext in project servicetalk by apple.
the class ProxyConnectConnectionFactoryFilterTest method cannotAccessNettyChannel.
@Test
void cannotAccessNettyChannel() {
// Does not implement NettyConnectionContext:
HttpExecutionContext executionContext = new HttpExecutionContextBuilder().build();
HttpConnectionContext connectionContext = (mock(HttpConnectionContext.class));
when(connectionContext.executionContext()).thenReturn(executionContext);
when(connection.connectionContext()).thenReturn(connectionContext);
configureRequestSend();
configureConnectRequest();
subscribeToProxyConnectionFactory();
assertThat(subscriber.awaitOnError(), instanceOf(ClassCastException.class));
assertConnectPayloadConsumed(false);
assertConnectionClosed();
}
use of io.servicetalk.http.api.HttpConnectionContext in project servicetalk by apple.
the class TimeoutHttpRequesterFilterTest method applyFilter.
private static Single<StreamingHttpResponse> applyFilter(TimeoutHttpRequesterFilter filterFactory, final HttpExecutionStrategy strategy, final Single<StreamingHttpResponse> responseSingle) {
HttpExecutionContext executionContext = new DefaultHttpExecutionContext(DEFAULT_ALLOCATOR, IO_EXECUTOR, EXECUTOR, strategy);
HttpConnectionContext connectionContext = mock(HttpConnectionContext.class);
when(connectionContext.executionContext()).thenReturn(executionContext);
FilterableStreamingHttpConnection connection = mock(FilterableStreamingHttpConnection.class);
when(connection.executionContext()).thenReturn(executionContext);
when(connection.request(any())).thenReturn(responseSingle);
StreamingHttpRequester requester = filterFactory.create(connection);
return requester.request(mock(StreamingHttpRequest.class));
}
Aggregations