/** * Set the default host name to be used by this client in requests if none is provided when making the request. * * @return a reference to this, so the API can be used fluently */ @Override public ConsulClientOptions setDefaultHost(String defaultHost) { return (ConsulClientOptions) super.setDefaultHost(defaultHost); }
/** * Creates an instance of {@link SlimVaultClient}. * * @param vertx the vert.x instance * @param configuration the configuration. This configuration can contain the underlying Web Client configuration. */ public SlimVaultClient(Vertx vertx, JsonObject configuration) { String host = configuration.getString("host"); Integer port = configuration.getInteger("port", 8200); Objects.requireNonNull(host, "The Vault host must be set"); client = WebClient.create(vertx, new WebClientOptions(configuration) .setDefaultPort(port).setDefaultHost(host) ); setToken(configuration.getString("token")); }
.setDefaultHost(elasticEdpt.getHost()) .setDefaultPort(elasticEdpt.getPort() != -1 ? elasticEdpt.getPort() : (HTTPS_SCHEME.equals(elasticEdpt.getScheme()) ? 443 : 80));
.setTrustAll(true) .setSsl(configuration.getBoolean("ssl", true)) .setDefaultHost(host) .setDefaultPort(port) .setFollowRedirects(true)
.setTrustAll(true) .setSsl(conf.getBoolean("ssl", true)) .setDefaultHost(host) .setDefaultPort(port) .setFollowRedirects(true)
private void testTLS(boolean clientSSL, boolean serverSSL, Function<WebClient, HttpRequest<Buffer>> requestProvider, Consumer<HttpServerRequest> serverAssertions) throws Exception { WebClientOptions clientOptions = new WebClientOptions() .setSsl(clientSSL) .setTrustAll(true) .setDefaultHost(DEFAULT_HTTPS_HOST) .setDefaultPort(DEFAULT_HTTPS_PORT); HttpServerOptions serverOptions = new HttpServerOptions() .setSsl(serverSSL) .setKeyStoreOptions(Cert.SERVER_JKS.get()) .setPort(DEFAULT_HTTPS_PORT) .setHost(DEFAULT_HTTPS_HOST); testTLS(clientOptions, serverOptions, requestProvider, serverAssertions); }
@Test public void testVirtualHostSNI() throws Exception { WebClientOptions clientOptions = new WebClientOptions() .setTrustAll(true) .setDefaultHost(DEFAULT_HTTPS_HOST) .setDefaultPort(DEFAULT_HTTPS_PORT); HttpServerOptions serverOptions = new HttpServerOptions() .setSsl(true) .setSni(true) .setKeyStoreOptions(Cert.SNI_JKS.get()) .setPort(DEFAULT_HTTPS_PORT) .setHost(DEFAULT_HTTPS_HOST); testTLS(clientOptions, serverOptions, req -> req.get("/").virtualHost("host2.com").ssl(true), req -> { assertEquals("host2.com", req.connection().indicatedServerName()); System.out.println(req.host()); }); }