use of org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory in project jetty.project by eclipse.
the class HTTP2Client method doStart.
@Override
protected void doStart() throws Exception {
if (executor == null)
setExecutor(new QueuedThreadPool());
if (scheduler == null)
setScheduler(new ScheduledExecutorScheduler());
if (bufferPool == null)
setByteBufferPool(new MappedByteBufferPool());
if (connectionFactory == null) {
HTTP2ClientConnectionFactory h2 = new HTTP2ClientConnectionFactory();
setClientConnectionFactory((endPoint, context) -> {
ClientConnectionFactory factory = h2;
SslContextFactory sslContextFactory = (SslContextFactory) context.get(SslClientConnectionFactory.SSL_CONTEXT_FACTORY_CONTEXT_KEY);
if (sslContextFactory != null) {
ALPNClientConnectionFactory alpn = new ALPNClientConnectionFactory(getExecutor(), h2, getProtocols());
factory = new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), alpn);
}
return factory.newConnection(endPoint, context);
});
}
if (selector == null) {
selector = newSelectorManager();
addBean(selector);
}
selector.setConnectTimeout(getConnectTimeout());
super.doStart();
}
use of org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory in project jetty.project by eclipse.
the class HttpClientTransportOverHTTP2 method newConnection.
@Override
public org.eclipse.jetty.io.Connection newConnection(EndPoint endPoint, Map<String, Object> context) throws IOException {
endPoint.setIdleTimeout(httpClient.getIdleTimeout());
ClientConnectionFactory factory = connectionFactory;
HttpDestinationOverHTTP2 destination = (HttpDestinationOverHTTP2) context.get(HTTP_DESTINATION_CONTEXT_KEY);
ProxyConfiguration.Proxy proxy = destination.getProxy();
boolean ssl = proxy == null ? HttpScheme.HTTPS.is(destination.getScheme()) : proxy.isSecure();
if (ssl && isUseALPN())
factory = new ALPNClientConnectionFactory(client.getExecutor(), factory, client.getProtocols());
return factory.newConnection(endPoint, context);
}
Aggregations