本文整理汇总了Java中io.vertx.core.net.SelfSignedCertificate类的典型用法代码示例。如果您正苦于以下问题:Java SelfSignedCertificate类的具体用法?Java SelfSignedCertificate怎么用?Java SelfSignedCertificate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelfSignedCertificate类属于io.vertx.core.net包,在下文中一共展示了SelfSignedCertificate类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRecordCreation
import io.vertx.core.net.SelfSignedCertificate; //导入依赖的package包/类
@Test
public void testRecordCreation(TestContext testContext) {
Record record = HttpEndpoint.createRecord("some-name", "123.456.789.111", 80, null);
assertThat(record.getLocation().getString(Record.ENDPOINT)).isEqualTo("http://123.456.789.111:80/");
record = HttpEndpoint.createRecord("some-name", "123.456.789.111", 80, "foo");
assertThat(record.getLocation().getString(Record.ENDPOINT)).isEqualTo("http://123.456.789.111:80/foo");
record = HttpEndpoint.createRecord("some-name", "123.456.789.111", 80, "foo", new JsonObject().put("language", "en"));
assertThat(record.getLocation().getString(Record.ENDPOINT)).isEqualTo("http://123.456.789.111:80/foo");
assertThat(record.getMetadata().getString("language")).isEqualTo("en");
record = HttpEndpoint.createRecord("some-name", "acme.org");
assertThat(record.getLocation().getString(Record.ENDPOINT)).isEqualTo("http://acme.org:80/");
SelfSignedCertificate selfSignedCertificate = SelfSignedCertificate.create();
vertx.createHttpServer(new HttpServerOptions()
.setHost("127.0.0.1")
.setSsl(true)
.setKeyCertOptions(selfSignedCertificate.keyCertOptions())
).requestHandler(request -> {
request.response().end(new JsonObject().put("url", request.absoluteURI()).encode());
}).listen(0, testContext.asyncAssertSuccess(server -> {
Record sslRecord = HttpEndpoint.createRecord("http-bin", true, "127.0.0.1", server.actualPort(), "/get", null);
ServiceReference reference = discovery.getReferenceWithConfiguration(sslRecord, new HttpClientOptions()
.setSsl(true)
.setTrustAll(true)
.setVerifyHost(false)
.toJson());
WebClient webClient = WebClient.wrap(reference.get());
webClient.get("/get").as(BodyCodec.jsonObject()).send(testContext.asyncAssertSuccess(resp -> {
assertEquals("https://127.0.0.1:" + server.actualPort() + "/get", resp.body().getString("url"));
}));
}));
}
示例2: generateSelfSigned
import io.vertx.core.net.SelfSignedCertificate; //导入依赖的package包/类
private TrustAndKeyProvider generateSelfSigned(CoreContext core, String storeId) {
core.logger(getClass())
.event(LOG_SECURITY, Level.WARNING).send(getMissingKeyStore());
return TrustAndKeyProvider.of(SelfSignedCertificate.create(CoreStrings.GITHUB));
}
示例3: of
import io.vertx.core.net.SelfSignedCertificate; //导入依赖的package包/类
/**
* @param self a self signed certificate to get trust and keycert options from.
* @return a new TrustAndKeyProvider instance.
*/
public static TrustAndKeyProvider of(SelfSignedCertificate self) {
return new TrustAndKeyProvider(self.trustOptions(), self.keyCertOptions());
}