Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
fb90666931
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.hazelcast.session;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.session.AbstractSessionDataStore;
|
import org.eclipse.jetty.server.session.AbstractSessionDataStore;
|
||||||
|
@ -74,7 +75,12 @@ public class HazelcastSessionDataStore
|
||||||
public boolean delete( String id )
|
public boolean delete( String id )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
return sessionDataMap == null ? false : sessionDataMap.remove( getCacheKey( id ) ) != null;
|
if (sessionDataMap == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//use delete which does not deserialize the SessionData object being removed
|
||||||
|
sessionDataMap.delete( getCacheKey(id));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMap<String, SessionData> getSessionDataMap()
|
public IMap<String, SessionData> getSessionDataMap()
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.http2.client.http;
|
package org.eclipse.jetty.http2.client.http;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -46,9 +44,10 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class DirectHTTP2OverTLSTest
|
public class DirectHTTP2OverTLSTest
|
||||||
{
|
{
|
||||||
private Server server;
|
private Server server;
|
||||||
|
@ -82,7 +81,9 @@ public class DirectHTTP2OverTLSTest
|
||||||
clientThreads.setName("client");
|
clientThreads.setName("client");
|
||||||
HttpClientTransportOverHTTP2 transport = new HttpClientTransportOverHTTP2(new HTTP2Client());
|
HttpClientTransportOverHTTP2 transport = new HttpClientTransportOverHTTP2(new HTTP2Client());
|
||||||
transport.setUseALPN(false);
|
transport.setUseALPN(false);
|
||||||
client = new HttpClient(transport, newSslContextFactory());
|
SslContextFactory sslContextFactory = newSslContextFactory();
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
|
client = new HttpClient(transport, sslContextFactory);
|
||||||
client.setExecutor(clientThreads);
|
client.setExecutor(clientThreads);
|
||||||
client.start();
|
client.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.io;
|
package org.eclipse.jetty.io;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -52,11 +47,14 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||||
import org.eclipse.jetty.util.thread.Scheduler;
|
import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
import org.eclipse.jetty.util.thread.TimerScheduler;
|
import org.eclipse.jetty.util.thread.TimerScheduler;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class SslConnectionTest
|
public class SslConnectionTest
|
||||||
{
|
{
|
||||||
private static final int TIMEOUT = 1000000;
|
private static final int TIMEOUT = 1000000;
|
||||||
|
@ -145,6 +143,7 @@ public class SslConnectionTest
|
||||||
_sslCtxFactory.setKeyManagerPassword("keypwd");
|
_sslCtxFactory.setKeyManagerPassword("keypwd");
|
||||||
_sslCtxFactory.setRenegotiationAllowed(true);
|
_sslCtxFactory.setRenegotiationAllowed(true);
|
||||||
_sslCtxFactory.setRenegotiationLimit(-1);
|
_sslCtxFactory.setRenegotiationLimit(-1);
|
||||||
|
_sslCtxFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
startManager();
|
startManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.osgi.test;
|
package org.eclipse.jetty.osgi.test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
|
|
||||||
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
|
|
||||||
import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -52,16 +45,19 @@ import org.osgi.framework.Bundle;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
|
|
||||||
/**
|
import static org.junit.Assert.assertEquals;
|
||||||
* HTTP2 setup.
|
import static org.junit.Assert.assertNotNull;
|
||||||
*/
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
|
||||||
|
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
|
||||||
|
import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
|
||||||
|
|
||||||
@RunWith(PaxExam.class)
|
@RunWith(PaxExam.class)
|
||||||
@ExamReactorStrategy(PerClass.class)
|
@ExamReactorStrategy(PerClass.class)
|
||||||
public class TestJettyOSGiBootHTTP2Conscrypt
|
public class TestJettyOSGiBootHTTP2Conscrypt
|
||||||
{
|
{
|
||||||
private static final String LOG_LEVEL = "WARN";
|
private static final String LOG_LEVEL = "WARN";
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BundleContext bundleContext;
|
private BundleContext bundleContext;
|
||||||
|
|
||||||
|
@ -90,7 +86,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt
|
||||||
options.add(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(LOG_LEVEL));
|
options.add(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(LOG_LEVEL));
|
||||||
options.add(systemProperty("org.eclipse.jetty.LEVEL").value(LOG_LEVEL));
|
options.add(systemProperty("org.eclipse.jetty.LEVEL").value(LOG_LEVEL));
|
||||||
options.add(CoreOptions.cleanCaches(true));
|
options.add(CoreOptions.cleanCaches(true));
|
||||||
return options.toArray(new Option[options.size()]);
|
return options.toArray(new Option[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Option> http2JettyDependencies()
|
public static List<Option> http2JettyDependencies()
|
||||||
|
@ -114,10 +110,8 @@ public class TestJettyOSGiBootHTTP2Conscrypt
|
||||||
res.add(mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-server").versionAsInProject().start());
|
res.add(mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-server").versionAsInProject().start());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void assertAllBundlesActiveOrResolved() throws Exception
|
public void assertAllBundlesActiveOrResolved()
|
||||||
{
|
{
|
||||||
TestOSGiUtil.debugBundles(bundleContext);
|
TestOSGiUtil.debugBundles(bundleContext);
|
||||||
Bundle conscrypt = TestOSGiUtil.getBundle(bundleContext, "org.eclipse.jetty.alpn.conscrypt.server");
|
Bundle conscrypt = TestOSGiUtil.getBundle(bundleContext, "org.eclipse.jetty.alpn.conscrypt.server");
|
||||||
|
@ -128,7 +122,6 @@ public class TestJettyOSGiBootHTTP2Conscrypt
|
||||||
assertTrue(services.length > 0);
|
assertTrue(services.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHTTP2() throws Exception
|
public void testHTTP2() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -151,6 +144,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt
|
||||||
sslContextFactory.setKeyStorePath(keys.getAbsolutePath());
|
sslContextFactory.setKeyStorePath(keys.getAbsolutePath());
|
||||||
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||||
sslContextFactory.setProvider("Conscrypt");
|
sslContextFactory.setProvider("Conscrypt");
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
HttpClient httpClient = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), sslContextFactory);
|
HttpClient httpClient = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), sslContextFactory);
|
||||||
Executor executor = new QueuedThreadPool();
|
Executor executor = new QueuedThreadPool();
|
||||||
httpClient.setExecutor(executor);
|
httpClient.setExecutor(executor);
|
||||||
|
@ -164,8 +158,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (client != null) client.stop();
|
client.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.osgi.test;
|
package org.eclipse.jetty.osgi.test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
|
|
||||||
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -51,16 +45,18 @@ import org.osgi.framework.Bundle;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
|
|
||||||
/**
|
import static org.junit.Assert.assertEquals;
|
||||||
* Test HTTP2 using java9 alpn.
|
import static org.junit.Assert.assertNotNull;
|
||||||
*/
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
|
||||||
|
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
|
||||||
|
|
||||||
@RunWith(PaxExam.class)
|
@RunWith(PaxExam.class)
|
||||||
@ExamReactorStrategy(PerClass.class)
|
@ExamReactorStrategy(PerClass.class)
|
||||||
public class TestJettyOSGiBootHTTP2JDK9
|
public class TestJettyOSGiBootHTTP2JDK9
|
||||||
{
|
{
|
||||||
private static final String LOG_LEVEL = "WARN";
|
private static final String LOG_LEVEL = "WARN";
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BundleContext bundleContext;
|
private BundleContext bundleContext;
|
||||||
|
|
||||||
|
@ -88,7 +84,7 @@ public class TestJettyOSGiBootHTTP2JDK9
|
||||||
options.add(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(LOG_LEVEL));
|
options.add(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(LOG_LEVEL));
|
||||||
options.add(systemProperty("org.eclipse.jetty.LEVEL").value(LOG_LEVEL));
|
options.add(systemProperty("org.eclipse.jetty.LEVEL").value(LOG_LEVEL));
|
||||||
options.add(CoreOptions.cleanCaches(true));
|
options.add(CoreOptions.cleanCaches(true));
|
||||||
return options.toArray(new Option[options.size()]);
|
return options.toArray(new Option[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Option> http2JettyDependencies()
|
public static List<Option> http2JettyDependencies()
|
||||||
|
@ -105,9 +101,8 @@ public class TestJettyOSGiBootHTTP2JDK9
|
||||||
res.add(mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-server").versionAsInProject().start());
|
res.add(mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-server").versionAsInProject().start());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void assertAllBundlesActiveOrResolved() throws Exception
|
public void assertAllBundlesActiveOrResolved()
|
||||||
{
|
{
|
||||||
TestOSGiUtil.debugBundles(bundleContext);
|
TestOSGiUtil.debugBundles(bundleContext);
|
||||||
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
|
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
|
||||||
|
@ -119,8 +114,6 @@ public class TestJettyOSGiBootHTTP2JDK9
|
||||||
assertNotNull(server);
|
assertNotNull(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHTTP2() throws Exception
|
public void testHTTP2() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -145,6 +138,7 @@ public class TestJettyOSGiBootHTTP2JDK9
|
||||||
sslContextFactory.setTrustStorePath(keys.getAbsolutePath());
|
sslContextFactory.setTrustStorePath(keys.getAbsolutePath());
|
||||||
sslContextFactory.setKeyStorePath(keys.getAbsolutePath());
|
sslContextFactory.setKeyStorePath(keys.getAbsolutePath());
|
||||||
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
httpClient = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), sslContextFactory);
|
httpClient = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), sslContextFactory);
|
||||||
Executor executor = new QueuedThreadPool();
|
Executor executor = new QueuedThreadPool();
|
||||||
httpClient.setExecutor(executor);
|
httpClient.setExecutor(executor);
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.proxy;
|
package org.eclipse.jetty.proxy;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -52,6 +48,10 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
public class ForwardProxyServerTest
|
public class ForwardProxyServerTest
|
||||||
{
|
{
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
|
@ -68,9 +68,7 @@ public class ForwardProxyServerTest
|
||||||
scenario2.setKeyManagerPassword("keypwd");
|
scenario2.setKeyManagerPassword("keypwd");
|
||||||
// TODO: add more SslContextFactory configurations/scenarios?
|
// TODO: add more SslContextFactory configurations/scenarios?
|
||||||
|
|
||||||
return Stream.of(
|
return Stream.of(scenario1, scenario2).map(Arguments::of);
|
||||||
scenario1, scenario2
|
|
||||||
).map(Arguments::of);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SslContextFactory serverSslContextFactory;
|
private SslContextFactory serverSslContextFactory;
|
||||||
|
@ -209,6 +207,7 @@ public class ForwardProxyServerTest
|
||||||
clientSsl.setKeyStorePath(keyStorePath);
|
clientSsl.setKeyStorePath(keyStorePath);
|
||||||
clientSsl.setKeyStorePassword("storepwd");
|
clientSsl.setKeyStorePassword("storepwd");
|
||||||
clientSsl.setKeyManagerPassword("keypwd");
|
clientSsl.setKeyManagerPassword("keypwd");
|
||||||
|
clientSsl.setEndpointIdentificationAlgorithm(null);
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(clientSsl);
|
HttpClient httpClient = new HttpClient(clientSsl);
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
|
|
|
@ -18,12 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.proxy;
|
package org.eclipse.jetty.proxy;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
@ -72,6 +66,12 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||||
|
|
||||||
public class ForwardProxyTLSServerTest
|
public class ForwardProxyTLSServerTest
|
||||||
{
|
{
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
|
@ -88,9 +88,7 @@ public class ForwardProxyTLSServerTest
|
||||||
scenario2.setKeyManagerPassword("keypwd");
|
scenario2.setKeyManagerPassword("keypwd");
|
||||||
// TODO: add more SslContextFactory configurations/scenarios?
|
// TODO: add more SslContextFactory configurations/scenarios?
|
||||||
|
|
||||||
return Stream.of(
|
return Stream.of(scenario1, scenario2).map(Arguments::of);
|
||||||
scenario1, scenario2
|
|
||||||
).map(Arguments::of);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SslContextFactory proxySslContextFactory;
|
private SslContextFactory proxySslContextFactory;
|
||||||
|
@ -109,7 +107,7 @@ public class ForwardProxyTLSServerTest
|
||||||
QueuedThreadPool serverThreads = new QueuedThreadPool();
|
QueuedThreadPool serverThreads = new QueuedThreadPool();
|
||||||
serverThreads.setName("server");
|
serverThreads.setName("server");
|
||||||
server = new Server(serverThreads);
|
server = new Server(serverThreads);
|
||||||
serverConnector = new ServerConnector(server, newSslContextFactory());
|
serverConnector = new ServerConnector(server, newServerSslContextFactory());
|
||||||
server.addConnector(serverConnector);
|
server.addConnector(serverConnector);
|
||||||
server.setHandler(handler);
|
server.setHandler(handler);
|
||||||
server.start();
|
server.start();
|
||||||
|
@ -139,7 +137,7 @@ public class ForwardProxyTLSServerTest
|
||||||
return new HttpProxy(new Origin.Address("localhost", proxyConnector.getLocalPort()), proxySslContextFactory != null);
|
return new HttpProxy(new Origin.Address("localhost", proxyConnector.getLocalPort()), proxySslContextFactory != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SslContextFactory newSslContextFactory()
|
private static SslContextFactory newServerSslContextFactory()
|
||||||
{
|
{
|
||||||
SslContextFactory sslContextFactory = new SslContextFactory();
|
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||||
String keyStorePath = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath();
|
String keyStorePath = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath();
|
||||||
|
@ -147,6 +145,14 @@ public class ForwardProxyTLSServerTest
|
||||||
sslContextFactory.setKeyStorePassword("storepwd");
|
sslContextFactory.setKeyStorePassword("storepwd");
|
||||||
sslContextFactory.setKeyManagerPassword("keypwd");
|
sslContextFactory.setKeyManagerPassword("keypwd");
|
||||||
return sslContextFactory;
|
return sslContextFactory;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SslContextFactory newClientSslContextFactory()
|
||||||
|
{
|
||||||
|
SslContextFactory sslContextFactory = newServerSslContextFactory();
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
|
return sslContextFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
|
@ -182,7 +188,7 @@ public class ForwardProxyTLSServerTest
|
||||||
startTLSServer(new ServerHandler());
|
startTLSServer(new ServerHandler());
|
||||||
startProxy();
|
startProxy();
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
@ -218,7 +224,7 @@ public class ForwardProxyTLSServerTest
|
||||||
startTLSServer(new ServerHandler());
|
startTLSServer(new ServerHandler());
|
||||||
startProxy();
|
startProxy();
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
@ -265,7 +271,7 @@ public class ForwardProxyTLSServerTest
|
||||||
startTLSServer(new ServerHandler());
|
startTLSServer(new ServerHandler());
|
||||||
startProxy();
|
startProxy();
|
||||||
|
|
||||||
final HttpClient httpClient = new HttpClient(newSslContextFactory());
|
final HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
@ -351,7 +357,7 @@ public class ForwardProxyTLSServerTest
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
// Short idle timeout for HttpClient.
|
// Short idle timeout for HttpClient.
|
||||||
httpClient.setIdleTimeout(idleTimeout);
|
httpClient.setIdleTimeout(idleTimeout);
|
||||||
|
@ -390,7 +396,7 @@ public class ForwardProxyTLSServerTest
|
||||||
int proxyPort = proxyConnector.getLocalPort();
|
int proxyPort = proxyConnector.getLocalPort();
|
||||||
stopProxy();
|
stopProxy();
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(new Origin.Address("localhost", proxyPort), proxySslContextFactory != null));
|
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(new Origin.Address("localhost", proxyPort), proxySslContextFactory != null));
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
@ -418,7 +424,7 @@ public class ForwardProxyTLSServerTest
|
||||||
stopServer();
|
stopServer();
|
||||||
startProxy();
|
startProxy();
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
@ -450,7 +456,7 @@ public class ForwardProxyTLSServerTest
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
@ -574,7 +580,7 @@ public class ForwardProxyTLSServerTest
|
||||||
startTLSServer(new ServerHandler());
|
startTLSServer(new ServerHandler());
|
||||||
startProxy(connectHandler);
|
startProxy(connectHandler);
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
HttpProxy httpProxy = newHttpProxy();
|
HttpProxy httpProxy = newHttpProxy();
|
||||||
if (includeAddress)
|
if (includeAddress)
|
||||||
httpProxy.getIncludedAddresses().add("localhost:" + serverConnector.getLocalPort());
|
httpProxy.getIncludedAddresses().add("localhost:" + serverConnector.getLocalPort());
|
||||||
|
@ -626,7 +632,7 @@ public class ForwardProxyTLSServerTest
|
||||||
SslContextFactory sslContextFactory = new SslContextFactory();
|
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||||
sslContextFactory.start();
|
sslContextFactory.start();
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient(newSslContextFactory());
|
HttpClient httpClient = new HttpClient(newClientSslContextFactory());
|
||||||
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
|
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<Set name="TrustStorePassword"><Property name="jetty.sslContext.trustStorePassword"/></Set>
|
<Set name="TrustStorePassword"><Property name="jetty.sslContext.trustStorePassword"/></Set>
|
||||||
<Set name="TrustStoreType"><Property name="jetty.sslContext.trustStoreType"/></Set>
|
<Set name="TrustStoreType"><Property name="jetty.sslContext.trustStoreType"/></Set>
|
||||||
<Set name="TrustStoreProvider"><Property name="jetty.sslContext.trustStoreProvider"/></Set>
|
<Set name="TrustStoreProvider"><Property name="jetty.sslContext.trustStoreProvider"/></Set>
|
||||||
\ <Set name="EndpointIdentificationAlgorithm"></Set>
|
<Set name="EndpointIdentificationAlgorithm"><Property name="jetty.sslContext.endpointIdentificationAlgorithm" default="HTTPS"/></Set>
|
||||||
<Set name="NeedClientAuth"><Property name="jetty.sslContext.needClientAuth" default="false"/></Set>
|
<Set name="NeedClientAuth"><Property name="jetty.sslContext.needClientAuth" default="false"/></Set>
|
||||||
<Set name="WantClientAuth"><Property name="jetty.sslContext.wantClientAuth" default="false"/></Set>
|
<Set name="WantClientAuth"><Property name="jetty.sslContext.wantClientAuth" default="false"/></Set>
|
||||||
<Set name="useCipherSuitesOrder"><Property name="jetty.sslContext.useCipherSuitesOrder" default="true"/></Set>
|
<Set name="useCipherSuitesOrder"><Property name="jetty.sslContext.useCipherSuitesOrder" default="true"/></Set>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
|
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
|
||||||
|
|
||||||
<Configure id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
<Configure>
|
||||||
|
|
||||||
<!-- =========================================================== -->
|
<!-- =========================================================== -->
|
||||||
<!-- Configure the Server Thread Pool. -->
|
<!-- Configure the Server Thread Pool. -->
|
||||||
<!-- The server holds a common thread pool which is used by -->
|
<!-- The server holds a common thread pool which is used by -->
|
||||||
|
@ -20,9 +19,11 @@
|
||||||
<!-- Consult the javadoc of o.e.j.util.thread.QueuedThreadPool -->
|
<!-- Consult the javadoc of o.e.j.util.thread.QueuedThreadPool -->
|
||||||
<!-- for all configuration that may be set here. -->
|
<!-- for all configuration that may be set here. -->
|
||||||
<!-- =========================================================== -->
|
<!-- =========================================================== -->
|
||||||
<Set name="minThreads" type="int"><Property name="jetty.threadPool.minThreads" deprecated="threads.min" default="10"/></Set>
|
<New id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||||
<Set name="maxThreads" type="int"><Property name="jetty.threadPool.maxThreads" deprecated="threads.max" default="200"/></Set>
|
<Set name="minThreads" type="int"><Property name="jetty.threadPool.minThreads" deprecated="threads.min" default="10"/></Set>
|
||||||
<Set name="reservedThreads" type="int"><Property name="jetty.threadPool.reservedThreads" default="-1"/></Set>
|
<Set name="maxThreads" type="int"><Property name="jetty.threadPool.maxThreads" deprecated="threads.max" default="200"/></Set>
|
||||||
<Set name="idleTimeout" type="int"><Property name="jetty.threadPool.idleTimeout" deprecated="threads.timeout" default="60000"/></Set>
|
<Set name="reservedThreads" type="int"><Property name="jetty.threadPool.reservedThreads" default="-1"/></Set>
|
||||||
<Set name="detailedDump" type="boolean"><Property name="jetty.threadPool.detailedDump" default="false"/></Set>
|
<Set name="idleTimeout" type="int"><Property name="jetty.threadPool.idleTimeout" deprecated="threads.timeout" default="60000"/></Set>
|
||||||
|
<Set name="detailedDump" type="boolean"><Property name="jetty.threadPool.detailedDump" default="false"/></Set>
|
||||||
|
</New>
|
||||||
</Configure>
|
</Configure>
|
||||||
|
|
|
@ -71,6 +71,7 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(HttpChannel.class);
|
private static final Logger LOG = Log.getLogger(HttpChannel.class);
|
||||||
|
|
||||||
private final AtomicBoolean _committed = new AtomicBoolean();
|
private final AtomicBoolean _committed = new AtomicBoolean();
|
||||||
private final AtomicBoolean _responseCompleted = new AtomicBoolean();
|
private final AtomicBoolean _responseCompleted = new AtomicBoolean();
|
||||||
private final AtomicLong _requests = new AtomicLong();
|
private final AtomicLong _requests = new AtomicLong();
|
||||||
|
@ -586,9 +587,10 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
||||||
else if (no_stack!=null)
|
else if (no_stack!=null)
|
||||||
{
|
{
|
||||||
// No stack trace unless there is debug turned on
|
// No stack trace unless there is debug turned on
|
||||||
LOG.warn("{} {}",_request.getRequestURI(), no_stack.toString());
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug(_request.getRequestURI(), failure);
|
LOG.debug(_request.getRequestURI(), failure);
|
||||||
|
else
|
||||||
|
LOG.warn("{} {}",_request.getRequestURI(), no_stack.toString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable
|
||||||
private int _sslSessionCacheSize = -1;
|
private int _sslSessionCacheSize = -1;
|
||||||
private int _sslSessionTimeout = -1;
|
private int _sslSessionTimeout = -1;
|
||||||
private SSLContext _setContext;
|
private SSLContext _setContext;
|
||||||
private String _endpointIdentificationAlgorithm = null;
|
private String _endpointIdentificationAlgorithm = "HTTPS";
|
||||||
private boolean _trustAll;
|
private boolean _trustAll;
|
||||||
private boolean _renegotiationAllowed = true;
|
private boolean _renegotiationAllowed = true;
|
||||||
private int _renegotiationLimit = 5;
|
private int _renegotiationLimit = 5;
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.eclipse.jetty.http2.client.http.HttpConnectionOverHTTP2;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets;
|
import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets;
|
||||||
import org.eclipse.jetty.util.Promise;
|
import org.eclipse.jetty.util.Promise;
|
||||||
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ArgumentsSource;
|
import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||||
|
@ -89,13 +90,15 @@ public class HttpChannelAssociationTest extends AbstractTest<TransportScenario>
|
||||||
scenario.startServer(new EmptyServerHandler());
|
scenario.startServer(new EmptyServerHandler());
|
||||||
|
|
||||||
long idleTimeout = 1000;
|
long idleTimeout = 1000;
|
||||||
|
SslContextFactory sslContextFactory = scenario.newSslContextFactory();
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
scenario.client = new HttpClient(newHttpClientTransport(scenario, exchange ->
|
scenario.client = new HttpClient(newHttpClientTransport(scenario, exchange ->
|
||||||
{
|
{
|
||||||
// We idle timeout just before the association,
|
// We idle timeout just before the association,
|
||||||
// we must be able to send the request successfully.
|
// we must be able to send the request successfully.
|
||||||
sleep(2 * idleTimeout);
|
sleep(2 * idleTimeout);
|
||||||
return true;
|
return true;
|
||||||
}), scenario.sslContextFactory);
|
}), sslContextFactory);
|
||||||
QueuedThreadPool clientThreads = new QueuedThreadPool();
|
QueuedThreadPool clientThreads = new QueuedThreadPool();
|
||||||
clientThreads.setName("client");
|
clientThreads.setName("client");
|
||||||
scenario.client.setExecutor(clientThreads);
|
scenario.client.setExecutor(clientThreads);
|
||||||
|
|
|
@ -18,16 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.http.client;
|
package org.eclipse.jetty.http.client;
|
||||||
|
|
||||||
import static org.eclipse.jetty.http.client.Transport.UNIX_SOCKET;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
|
@ -64,10 +54,21 @@ import org.eclipse.jetty.io.ssl.SslConnection;
|
||||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
import org.eclipse.jetty.util.FuturePromise;
|
import org.eclipse.jetty.util.FuturePromise;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.junit.jupiter.api.Assumptions;
|
import org.junit.jupiter.api.Assumptions;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ArgumentsSource;
|
import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||||
|
|
||||||
|
import static org.eclipse.jetty.http.client.Transport.UNIX_SOCKET;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,7 +85,8 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
||||||
long timeout = 1000;
|
long timeout = 1000;
|
||||||
scenario.start(new TimeoutHandler(2 * timeout));
|
scenario.start(new TimeoutHandler(2 * timeout));
|
||||||
|
|
||||||
assertThrows(TimeoutException.class, ()-> {
|
assertThrows(TimeoutException.class, () ->
|
||||||
|
{
|
||||||
scenario.client.newRequest(scenario.newURI())
|
scenario.client.newRequest(scenario.newURI())
|
||||||
.timeout(timeout, TimeUnit.MILLISECONDS)
|
.timeout(timeout, TimeUnit.MILLISECONDS)
|
||||||
.send();
|
.send();
|
||||||
|
@ -249,7 +251,9 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
||||||
scenario.startServer(new TimeoutHandler(2 * timeout));
|
scenario.startServer(new TimeoutHandler(2 * timeout));
|
||||||
|
|
||||||
AtomicBoolean sslIdle = new AtomicBoolean();
|
AtomicBoolean sslIdle = new AtomicBoolean();
|
||||||
scenario.client = new HttpClient(scenario.provideClientTransport(), scenario.sslContextFactory)
|
SslContextFactory sslContextFactory = scenario.newSslContextFactory();
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
|
scenario.client = new HttpClient(scenario.provideClientTransport(), sslContextFactory)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
|
public ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
|
||||||
|
@ -275,7 +279,8 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
||||||
scenario.client.setIdleTimeout(timeout);
|
scenario.client.setIdleTimeout(timeout);
|
||||||
scenario.client.start();
|
scenario.client.start();
|
||||||
|
|
||||||
assertThrows(TimeoutException.class, ()->{
|
assertThrows(TimeoutException.class, () ->
|
||||||
|
{
|
||||||
scenario.client.newRequest(scenario.newURI())
|
scenario.client.newRequest(scenario.newURI())
|
||||||
.send();
|
.send();
|
||||||
});
|
});
|
||||||
|
@ -427,14 +432,17 @@ public class HttpClientTimeoutTest extends AbstractTest<TransportScenario>
|
||||||
|
|
||||||
long timeout = 1000;
|
long timeout = 1000;
|
||||||
String uri = "badscheme://0.0.0.1";
|
String uri = "badscheme://0.0.0.1";
|
||||||
if(scenario.getNetworkConnectorLocalPort().isPresent())
|
if (scenario.getNetworkConnectorLocalPort().isPresent())
|
||||||
uri += ":" + scenario.getNetworkConnectorLocalPort().get();
|
uri += ":" + scenario.getNetworkConnectorLocalPort().get();
|
||||||
Request request = scenario.client.newRequest(uri);
|
Request request = scenario.client.newRequest(uri);
|
||||||
|
|
||||||
// TODO: assert a more specific Throwable
|
// TODO: assert a more specific Throwable
|
||||||
assertThrows(Exception.class, ()-> {
|
assertThrows(Exception.class, () ->
|
||||||
|
{
|
||||||
request.timeout(timeout, TimeUnit.MILLISECONDS)
|
request.timeout(timeout, TimeUnit.MILLISECONDS)
|
||||||
.send(result -> {});
|
.send(result ->
|
||||||
|
{
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Thread.sleep(2 * timeout);
|
Thread.sleep(2 * timeout);
|
||||||
|
|
|
@ -298,6 +298,8 @@ public class TransportScenario
|
||||||
QueuedThreadPool clientThreads = new QueuedThreadPool();
|
QueuedThreadPool clientThreads = new QueuedThreadPool();
|
||||||
clientThreads.setName("client");
|
clientThreads.setName("client");
|
||||||
clientThreads.setDetailedDump(true);
|
clientThreads.setDetailedDump(true);
|
||||||
|
SslContextFactory sslContextFactory = newSslContextFactory();
|
||||||
|
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
client = newHttpClient(provideClientTransport(transport), sslContextFactory);
|
client = newHttpClient(provideClientTransport(transport), sslContextFactory);
|
||||||
client.setExecutor(clientThreads);
|
client.setExecutor(clientThreads);
|
||||||
client.setSocketAddressResolver(new SocketAddressResolver.Sync());
|
client.setSocketAddressResolver(new SocketAddressResolver.Sync());
|
||||||
|
@ -322,13 +324,7 @@ public class TransportScenario
|
||||||
|
|
||||||
public void startServer(Handler handler) throws Exception
|
public void startServer(Handler handler) throws Exception
|
||||||
{
|
{
|
||||||
sslContextFactory = new SslContextFactory();
|
sslContextFactory = newSslContextFactory();
|
||||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
|
||||||
sslContextFactory.setKeyStorePassword("storepwd");
|
|
||||||
sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks");
|
|
||||||
sslContextFactory.setTrustStorePassword("storepwd");
|
|
||||||
sslContextFactory.setUseCipherSuitesOrder(true);
|
|
||||||
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
|
|
||||||
QueuedThreadPool serverThreads = new QueuedThreadPool();
|
QueuedThreadPool serverThreads = new QueuedThreadPool();
|
||||||
serverThreads.setName("server");
|
serverThreads.setName("server");
|
||||||
serverThreads.setDetailedDump(true);
|
serverThreads.setDetailedDump(true);
|
||||||
|
@ -356,6 +352,18 @@ public class TransportScenario
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SslContextFactory newSslContextFactory()
|
||||||
|
{
|
||||||
|
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||||
|
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||||
|
sslContextFactory.setKeyStorePassword("storepwd");
|
||||||
|
sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks");
|
||||||
|
sslContextFactory.setTrustStorePassword("storepwd");
|
||||||
|
sslContextFactory.setUseCipherSuitesOrder(true);
|
||||||
|
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
|
||||||
|
return sslContextFactory;
|
||||||
|
}
|
||||||
|
|
||||||
public void stopClient() throws Exception
|
public void stopClient() throws Exception
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
|
|
|
@ -18,6 +18,29 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.test;
|
package org.eclipse.jetty.test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.Inet4Address;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLSocket;
|
||||||
|
import javax.servlet.AsyncContext;
|
||||||
|
import javax.servlet.ReadListener;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.ServletInputStream;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;
|
import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
|
@ -36,9 +59,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.util.JavaVersion;
|
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.hamcrest.Matchers;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.condition.DisabledOnJre;
|
import org.junit.jupiter.api.condition.DisabledOnJre;
|
||||||
|
@ -47,32 +68,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
import javax.net.ssl.SSLSocket;
|
|
||||||
import javax.servlet.AsyncContext;
|
|
||||||
import javax.servlet.ReadListener;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.ServletInputStream;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
|
||||||
|
|
||||||
public class HttpInputIntegrationTest
|
public class HttpInputIntegrationTest
|
||||||
{
|
{
|
||||||
|
@ -107,6 +105,7 @@ public class HttpInputIntegrationTest
|
||||||
__sslContextFactory.setKeyStorePath(jetty_distro + "/../../../jetty-server/src/test/config/etc/keystore");
|
__sslContextFactory.setKeyStorePath(jetty_distro + "/../../../jetty-server/src/test/config/etc/keystore");
|
||||||
__sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
__sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||||
__sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
|
__sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
|
||||||
|
__sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||||
|
|
||||||
// HTTPS Configuration
|
// HTTPS Configuration
|
||||||
__sslConfig = new HttpConfiguration(__config);
|
__sslConfig = new HttpConfiguration(__config);
|
||||||
|
|
Loading…
Reference in New Issue