use of io.vertx.core.http.HttpClientOptions in project vert.x by eclipse.
the class SSLHelperTest method testUseJdkCiphersWhenNotSpecified.
@Test
public void testUseJdkCiphersWhenNotSpecified() throws Exception {
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, null, null);
SSLEngine engine = context.createSSLEngine();
String[] expected = engine.getEnabledCipherSuites();
SSLHelper helper = new SSLHelper(new HttpClientOptions(), Cert.CLIENT_JKS.get(), Trust.SERVER_JKS.get());
SslContext ctx = helper.getContext((VertxInternal) vertx);
assertEquals(new HashSet<>(Arrays.asList(expected)), new HashSet<>(ctx.cipherSuites()));
}
use of io.vertx.core.http.HttpClientOptions in project vert.x by eclipse.
the class SSLHelperTest method testUseOpenSSLCiphersWhenNotSpecified.
@Test
public void testUseOpenSSLCiphersWhenNotSpecified() throws Exception {
Set<String> expected = OpenSsl.availableOpenSslCipherSuites();
SSLHelper helper = new SSLHelper(new HttpClientOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions()), Cert.CLIENT_PEM.get(), Trust.SERVER_PEM.get());
SslContext ctx = helper.getContext((VertxInternal) vertx);
assertEquals(expected, new HashSet<>(ctx.cipherSuites()));
}
use of io.vertx.core.http.HttpClientOptions in project vert.x by eclipse.
the class HTTP2Examples method useMaxStreams.
public void useMaxStreams(Vertx vertx) {
HttpClientOptions clientOptions = new HttpClientOptions().setHttp2MultiplexingLimit(10).setHttp2MaxPoolSize(3);
// Uses up to 3 connections and up to 10 streams per connection
HttpClient client = vertx.createHttpClient(clientOptions);
}
use of io.vertx.core.http.HttpClientOptions in project vert.x by eclipse.
the class HTTP2Examples method example8.
public void example8(Vertx vertx) {
HttpClientOptions options = new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2);
HttpClient client = vertx.createHttpClient(options);
}
use of io.vertx.core.http.HttpClientOptions in project vert.x by eclipse.
the class FileResolverTestBase method testSendFileFromClasspath.
@Test
public void testSendFileFromClasspath() {
vertx.createHttpServer(new HttpServerOptions().setPort(8080)).requestHandler(res -> {
res.response().sendFile("webroot/somefile.html");
}).listen(onSuccess(res -> {
vertx.createHttpClient(new HttpClientOptions()).request(HttpMethod.GET, 8080, "localhost", "/").compose(HttpClientRequest::send).onComplete(onSuccess(resp -> {
resp.bodyHandler(buff -> {
assertTrue(buff.toString().startsWith("<html><body>blah</body></html>"));
testComplete();
});
}));
}));
await();
}
Aggregations