package in.notwork;

import com.google.gson.Gson;
import com.google.maps.DistanceMatrixApi;
import com.google.maps.DistanceMatrixApiRequest;
import com.google.maps.GeoApiContext;
import com.google.maps.model.DistanceMatrix;
import com.google.maps.model.Unit;

import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;

/**
 * Hello world!
 */
public class App {

    public static final String API_KEY = "AIzaSyCkjTXp7I6gaA0zg5iJpX39nQw4oiYw77s";

    public static void main(String[] args) {

        String[] origins = {"12.9752265,77.7391331"};
        String[] destinations = {"12.9752265,77.7391331"};

        GeoApiContext context = new GeoApiContext().setApiKey(API_KEY);
        SocketAddress address = new InetSocketAddress("stbeproxy.symphonyteleca.com", 8080);
        Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
        context.setProxy(proxy);
        DistanceMatrixApiRequest request = DistanceMatrixApi.getDistanceMatrix(context, origins, destinations);
        try {
            DistanceMatrix matrix = request.units(Unit.METRIC).await();
            Gson gson = new Gson();
            System.out.println(gson.toJson(matrix));
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}

@@ -433,50 +433,11 @@
  = %22
-AIzaSyCkjTXp7I6gaA0zg5iJpX39nQw4oiYw77s
 %22;%0A
+
 %0A   
@@ -516,85 +516,759 @@
 12.9
-752265,77.7391331%22%7D;%0A        String%5B%5D destinations = %7B%2212.9752265,77.7391331%22
+2386,77.65312%22,%0A                %2212.92603,77.67625%22,%0A                %2212.87206,77.55859%22,%0A                %2212.96899,77.61006%22,%0A                %2212.96934,77.60854%22,%0A                %2212.88021,77.64558%22,%0A                %2213.09264,77.5862%22,%0A                %2213.08792,77.58914%22,%0A                %2213.0782,77.58725%22,%0A                %2213.09445,77.58601%22%0A%0A        %7D;%0A        String%5B%5D destinations = %7B%2212.92386,77.65312%22,%0A                %2212.92603,77.67625%22,%0A                %2212.87206,77.55859%22,%0A                %2212.96899,77.61006%22,%0A                %2212.96934,77.60854%22,%0A                %2212.88021,77.64558%22,%0A                %2213.09264,77.5862%22,%0A                %2213.08792,77.58914%22,%0A                %2213.0782,77.58725%22,%0A                %2213.09445,77.58601%22%0A%0A        
 %7D;%0A%0A

Add sample for DistanceMatrix API.