use of io.vertx.core.net.ProxyOptions in project vert.x by eclipse.
the class Http1xProxyTest method testWsHttpProxy.
@Test
public void testWsHttpProxy() throws Exception {
startProxy(null, ProxyType.HTTP);
testWebSocket(createBaseServerOptions(), new HttpClientOptions().setProxyOptions(new ProxyOptions().setType(ProxyType.HTTP).setHost(DEFAULT_HTTP_HOST).setPort(proxy.getPort())), true);
}
use of io.vertx.core.net.ProxyOptions in project vert.x by eclipse.
the class Http1xProxyTest method testWssHttpProxy.
@Test
public void testWssHttpProxy() throws Exception {
startProxy(null, ProxyType.HTTP);
testWebSocket(createBaseServerOptions().setSsl(true).setKeyCertOptions(Cert.SERVER_JKS.get()), new HttpClientOptions().setSsl(true).setTrustOptions(Cert.SERVER_JKS.get()).setProxyOptions(new ProxyOptions().setType(ProxyType.HTTP).setHost(DEFAULT_HTTP_HOST).setPort(proxy.getPort())), true);
}
use of io.vertx.core.net.ProxyOptions in project vert.x by eclipse.
the class Http1xProxyTest method testHttpProxyRequest2.
@Test
public void testHttpProxyRequest2() throws Exception {
startProxy(null, ProxyType.HTTP);
testHttpProxyRequest(() -> client.request(new RequestOptions().setProxyOptions(new ProxyOptions().setType(ProxyType.HTTP).setHost("localhost").setPort(proxy.getPort())).setHost(DEFAULT_HTTP_HOST).setPort(DEFAULT_HTTP_PORT).setURI("/")).compose(HttpClientRequest::send)).onComplete(onSuccess(v -> {
assertProxiedRequest(DEFAULT_HTTP_HOST);
testComplete();
}));
await();
}
use of io.vertx.core.net.ProxyOptions in project java-chassis by ServiceComb.
the class DefaultMonitorDataPublisher method createHttpClientOptions.
private HttpClientOptions createHttpClientOptions() {
HttpClientOptions httpClientOptions = new HttpClientOptions();
if (MonitorConstant.isProxyEnable()) {
ProxyOptions proxy = new ProxyOptions();
proxy.setHost(MonitorConstant.getProxyHost());
proxy.setPort(MonitorConstant.getProxyPort());
proxy.setUsername(MonitorConstant.getProxyUsername());
proxy.setPassword(MonitorConstant.getProxyPasswd());
httpClientOptions.setProxyOptions(proxy);
}
httpClientOptions.setConnectTimeout(MonitorConstant.getConnectionTimeout());
if (MonitorConstant.sslEnabled()) {
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.buildHttpClientOptions(sslOption, sslCustom, httpClientOptions);
}
return httpClientOptions;
}
use of io.vertx.core.net.ProxyOptions in project java-chassis by ServiceComb.
the class HttpClientOptionsSPI method createHttpClientOptions.
static HttpClientOptions createHttpClientOptions(HttpClientOptionsSPI spi) {
HttpClientOptions httpClientOptions = new HttpClientOptions();
httpClientOptions.setProtocolVersion(spi.getHttpVersion());
httpClientOptions.setConnectTimeout(spi.getConnectTimeoutInMillis());
httpClientOptions.setIdleTimeout(spi.getIdleTimeoutInSeconds());
httpClientOptions.setTryUseCompression(spi.isTryUseCompression());
httpClientOptions.setMaxWaitQueueSize(spi.getMaxWaitQueueSize());
httpClientOptions.setMaxPoolSize(spi.getMaxPoolSize());
httpClientOptions.setKeepAlive(spi.isKeepAlive());
httpClientOptions.setMaxHeaderSize(spi.getMaxHeaderSize());
httpClientOptions.setKeepAliveTimeout(spi.getKeepAliveTimeout());
if (spi.isProxyEnable()) {
ProxyOptions proxy = new ProxyOptions();
proxy.setHost(spi.getProxyHost());
proxy.setPort(spi.getProxyPort());
proxy.setUsername(spi.getProxyUsername());
proxy.setPassword(Encryptions.decode(spi.getProxyPassword(), spi.getConfigTag()));
httpClientOptions.setProxyOptions(proxy);
}
if (spi.getHttpVersion() == HttpVersion.HTTP_2) {
httpClientOptions.setHttp2ClearTextUpgrade(false);
httpClientOptions.setUseAlpn(spi.isUseAlpn());
httpClientOptions.setHttp2MultiplexingLimit(spi.getHttp2MultiplexingLimit());
httpClientOptions.setHttp2MaxPoolSize(spi.getHttp2MaxPoolSize());
}
if (spi.isSsl()) {
VertxTLSBuilder.buildHttpClientOptions(spi.getConfigTag(), httpClientOptions);
}
return httpClientOptions;
}
Aggregations