@@ -41,26 +41,14 @@ private ProxyExample() { }
4141 public static void main (final String [] args ) throws Exception {
4242 // Run docker-compose.yml file to start Envoy proxy
4343
44- URI queryProxyUri = new URI ("proxyUrl" );
45- URI uri = new URI (System .getenv ("url" ));
46-
47- ProxyDetector proxyDetector = (targetServerAddress ) -> {
48- InetSocketAddress targetAddress = (InetSocketAddress ) targetServerAddress ;
49- if (uri .getHost ().equals (targetAddress .getHostString ())) {
50- return HttpConnectProxiedSocketAddress .newBuilder ()
51- .setProxyAddress (new InetSocketAddress (queryProxyUri .getHost (), queryProxyUri .getPort ()))
52- .setTargetAddress (targetAddress )
53- .build ();
54- }
55- return null ;
56- };
57- ProxySelector proxy = ProxySelector .of (new InetSocketAddress (queryProxyUri .getHost (), queryProxyUri .getPort ()));
44+ String proxyUrl = "http://127.0.0.1:10000" ;
45+ String certificateFilePath = "src/test/java/com/influxdb/v3/client/testdata/valid-certificates.pem" ;
5846 ClientConfig clientConfig = new ClientConfig .Builder ()
59- .host (uri . toString ( ))
60- .token (System .getenv ("token " ).toCharArray ())
61- .database (System .getenv ("database " ))
62- .proxy ( proxy )
63- .queryApiProxy ( proxyDetector )
47+ .host (System . getenv ( "TESTING_INFLUXDB_URL" ))
48+ .token (System .getenv ("TESTING_INFLUXDB_TOKEN " ).toCharArray ())
49+ .database (System .getenv ("TESTING_INFLUXDB_DATABASE " ))
50+ .proxyUrl ( proxyUrl )
51+ .certificateFilePath ( certificateFilePath )
6452 .build ();
6553
6654 InfluxDBClient influxDBClient = InfluxDBClient .getInstance (clientConfig );
@@ -72,7 +60,7 @@ public static void main(final String[] args) throws Exception {
7260 try (Stream <PointValues > stream = influxDBClient .queryPoints ("SELECT * FROM test1" )) {
7361 stream .findFirst ()
7462 .ifPresent (pointValues -> {
75- // do something
63+ Assertions . assertThat ( pointValues . getField ( "field" )). isEqualTo ( "field1" );
7664 });
7765 }
7866 }
0 commit comments