clean up alpn protocol configuration

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-03-24 12:34:10 +01:00 committed by Simone Bordet
parent 89369b9c25
commit 82960f417e
2 changed files with 12 additions and 8 deletions

View File

@ -69,15 +69,11 @@ public class ClientQuicConnector extends ContainerLifeCycle implements IClientCo
private SocketAddress bindAddress;
private boolean reuseAddress = true;
public ClientQuicConnector(Origin.Protocol... protocols)
public ClientQuicConnector(Origin.Protocol protocol)
{
String[] applicationProtos = Arrays.stream(protocols)
.flatMap(protocol -> protocol.getProtocols().stream())
.toArray(String[]::new);
// TODO make the QuicheConfig configurable
quicheConfig = new QuicheConfig();
quicheConfig.setApplicationProtos(applicationProtos);
quicheConfig.setApplicationProtos(protocol.getProtocols().toArray(new String[0]));
quicheConfig.setMaxIdleTimeout(5000L);
quicheConfig.setInitialMaxData(10000000L);
quicheConfig.setInitialMaxStreamDataBidiLocal(10000000L);

View File

@ -15,7 +15,10 @@ package org.eclipse.jetty.http3.client;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.jetty.client.AbstractHttpClientTransport;
import org.eclipse.jetty.client.HttpClient;
@ -41,8 +44,13 @@ public class HttpClientTransportOverQuic extends AbstractHttpClientTransport
public HttpClientTransportOverQuic()
{
//TODO the ClientConnectionFactory should be built according to the Protocol instance. See HttpClientTransportDynamic
protocol = new Origin.Protocol(HttpClientConnectionFactory.HTTP11.getProtocols(true), false);
this(HttpClientConnectionFactory.HTTP11);
}
public HttpClientTransportOverQuic(ClientConnectionFactory.Info... factoryInfos)
{
List<String> protocolNames = Arrays.stream(factoryInfos).flatMap(info -> info.getProtocols(true).stream()).collect(Collectors.toList());
protocol = new Origin.Protocol(protocolNames, false);
connector = new ClientQuicConnector(protocol);
addBean(connector);
setConnectionPoolFactory(destination ->