当前位置: 首页>>代码示例>>Java>>正文


Java SelfSignedCertificate类代码示例

本文整理汇总了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"));
    }));
  }));
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:38,代码来源:HttpEndpointTest.java

示例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));
}
 
开发者ID:codingchili,项目名称:chili-core,代码行数:7,代码来源:SecuritySettings.java

示例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());
}
 
开发者ID:codingchili,项目名称:chili-core,代码行数:8,代码来源:TrustAndKeyProvider.java


注:本文中的io.vertx.core.net.SelfSignedCertificate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。