use of io.vertx.core.http.HttpServerOptions in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildHttpServerOptionsRequest.
@Test
public void testbuildHttpServerOptionsRequest() {
SSLOption option = SSLOption.buildFromYaml("rest.provider");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpServerOptions serverOptions = new HttpServerOptions();
new MockUp<SSLOption>() {
@Mock
public boolean isAuthPeer() {
return false;
}
};
VertxTLSBuilder.buildNetServerOptions(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.getClientAuth(), ClientAuth.REQUEST);
}
use of io.vertx.core.http.HttpServerOptions in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildHttpServerOptions.
@Test
public void testbuildHttpServerOptions() {
SSLOption option = SSLOption.buildFromYaml("rest.provider");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpServerOptions serverOptions = new HttpServerOptions();
VertxTLSBuilder.buildNetServerOptions(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.getClientAuth(), ClientAuth.REQUEST);
}
use of io.vertx.core.http.HttpServerOptions in project java-chassis by ServiceComb.
the class RestServerVerticle method createDefaultHttpServerOptions.
private HttpServerOptions createDefaultHttpServerOptions() {
HttpServerOptions serverOptions = new HttpServerOptions();
serverOptions.setAcceptBacklog(ACCEPT_BACKLOG);
serverOptions.setSendBufferSize(SEND_BUFFER_SIZE);
serverOptions.setReceiveBufferSize(RECEIVE_BUFFER_SIZE);
serverOptions.setUsePooledBuffers(true);
if (endpointObject.isSslEnabled()) {
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(SSL_KEY, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(SSL_KEY);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions);
}
return serverOptions;
}
use of io.vertx.core.http.HttpServerOptions in project vert.x by eclipse.
the class DummyMetricsTest method testDummyHttpServerMetrics.
@Test
public void testDummyHttpServerMetrics() {
HttpServer server = vertx.createHttpServer(new HttpServerOptions());
assertFalse(server.isMetricsEnabled());
}
use of io.vertx.core.http.HttpServerOptions in project vert.x by eclipse.
the class NettyCompatTest method testHttp2.
@Test
public void testHttp2() {
vertx.createHttpServer(new HttpServerOptions().setUseAlpn(true).setSsl(true).setSslEngineOptions(new OpenSSLEngineOptions()).setKeyCertOptions(Cert.SERVER_JKS.get())).requestHandler(req -> req.response().end("OK")).listen(8443, "localhost", onSuccess(s -> {
HttpClient client = vertx.createHttpClient(new HttpClientOptions().setSsl(true).setSslEngineOptions(new OpenSSLEngineOptions()).setTrustStoreOptions(Trust.SERVER_JKS.get()));
client.getNow(8443, "localhost", "/somepath", resp -> {
resp.bodyHandler(buff -> {
assertEquals("OK", buff.toString());
testComplete();
});
});
}));
await();
}
Aggregations