OkHttp proxy settings

后端 未结 3 2048
情歌与酒
情歌与酒 2021-02-07 00:14

I have to setup a proxy to send a JSON using POST, using proxyHost and proxyPort.

public static final MediaType JSON = MediaType.parse(\"application/json; charse         


        
3条回答
  •  名媛妹妹
    2021-02-07 00:30

    Found the solution:

      OkHttpClient client = new OkHttpClient.Builder().proxy(proxyTest).build();
    

    If we use the builder to input the proxy, it will work like a charm =D

提交回复
热议问题