package com.brilliance.isc.tool.compareviewpage;

import okhttp3.*;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class HttpTool {

    private static final OkHttpClient httpClient;

    static {
        httpClient = new OkHttpClient().
                newBuilder().connectTimeout(60, TimeUnit.SECONDS)
                .writeTimeout(60, TimeUnit.SECONDS)
                .readTimeout(60, TimeUnit.SECONDS).build();
    }

    static void httpCall() {

        RequestBody requestBody=RequestBody.create("",MediaType.parse("application/json;charset=UTF-8"));
        Request request=new Request.Builder()
                .url("http://10.233.154.130:22005/webapi/SSTF/DZL1")
                .post(requestBody)
                .build();
        try {
            Response response=httpClient.newCall(request).execute();

            System.out.println(response.body().string());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        httpCall();
    }
}
