use of io.vertx.core.impl.VertxInternal in project vert.x by eclipse.
the class VertxTracerFactoryTest method testNoOptions.
@Test
public void testNoOptions() {
VertxInternal v = (VertxInternal) Vertx.vertx();
assertNull(v.tracer());
}
use of io.vertx.core.impl.VertxInternal in project vert.x by eclipse.
the class MetricsOptionsTest method testMetricsFromServiceLoader.
@Test
public void testMetricsFromServiceLoader() {
vertx.close();
MetricsOptions metricsOptions = new MetricsOptions().setEnabled(true);
VertxOptions options = new VertxOptions().setMetricsOptions(metricsOptions);
vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
assertNotNull(metrics);
assertTrue(metrics instanceof FakeVertxMetrics);
assertEquals(metricsOptions.isEnabled(), ((FakeVertxMetrics) metrics).options().isEnabled());
}
use of io.vertx.core.impl.VertxInternal in project vert.x by eclipse.
the class MetricsOptionsTest method testMetricsEnabledWithoutConfig.
@Test
public void testMetricsEnabledWithoutConfig() {
vertx.close();
vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true)));
VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
assertNull(metrics);
}
use of io.vertx.core.impl.VertxInternal in project vert.x by eclipse.
the class SSLHelper method getTrustMgrFactory.
private TrustManagerFactory getTrustMgrFactory(VertxInternal vertx, String serverName) throws Exception {
TrustManager[] mgrs = null;
if (trustAll) {
mgrs = new TrustManager[] { createTrustAllTrustManager() };
} else if (trustOptions != null) {
if (serverName != null) {
Function<String, TrustManager[]> mapper = trustOptions.trustManagerMapper(vertx);
if (mapper != null) {
mgrs = mapper.apply(serverName);
}
if (mgrs == null) {
TrustManagerFactory fact = trustOptions.getTrustManagerFactory(vertx);
if (fact != null) {
mgrs = fact.getTrustManagers();
}
}
} else {
TrustManagerFactory fact = trustOptions.getTrustManagerFactory(vertx);
if (fact != null) {
mgrs = fact.getTrustManagers();
}
}
}
if (mgrs == null) {
return null;
}
if (crlPaths != null && crlValues != null && (crlPaths.size() > 0 || crlValues.size() > 0)) {
Stream<Buffer> tmp = crlPaths.stream().map(path -> vertx.resolveFile(path).getAbsolutePath()).map(vertx.fileSystem()::readFileBlocking);
tmp = Stream.concat(tmp, crlValues.stream());
CertificateFactory certificatefactory = CertificateFactory.getInstance("X.509");
ArrayList<CRL> crls = new ArrayList<>();
for (Buffer crlValue : tmp.collect(Collectors.toList())) {
crls.addAll(certificatefactory.generateCRLs(new ByteArrayInputStream(crlValue.getBytes())));
}
mgrs = createUntrustRevokedCertTrustManager(mgrs, crls);
}
return new VertxTrustManagerFactory(mgrs);
}
use of io.vertx.core.impl.VertxInternal in project vert.x by eclipse.
the class ChannelProvider method handleConnect.
private void handleConnect(Handler<Channel> handler, SocketAddress remoteAddress, SocketAddress peerAddress, String serverName, boolean ssl, boolean useAlpn, Promise<Channel> channelHandler) {
VertxInternal vertx = context.owner();
bootstrap.resolver(vertx.nettyAddressResolverGroup());
bootstrap.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) {
initSSL(handler, peerAddress, serverName, ssl, useAlpn, ch, channelHandler);
}
});
ChannelFuture fut = bootstrap.connect(vertx.transport().convert(remoteAddress));
fut.addListener(res -> {
if (res.isSuccess()) {
connected(handler, fut.channel(), ssl, channelHandler);
} else {
channelHandler.setFailure(res.cause());
}
});
}
Aggregations