コード例 #1
0
ファイル: Communicator.cs プロジェクト: Neophear/ADUCMobile
        public Communicator()
        {
            trustAllSslContext = SSLContext.GetInstance("SSL");
            trustAllSslContext.Init(null, new ITrustManager[] { new CustomX509TrustManager() }, new SecureRandom());

            client = new OkHttpClient();
            client.SetConnectTimeout(5, Java.Util.Concurrent.TimeUnit.Seconds);
            client.SetSslSocketFactory(trustAllSslContext.SocketFactory);
            client.SetHostnameVerifier(new CustomHostNameVerifier());
            client.SetProtocols(new Protocol[] { Protocol.Http11 });

            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build();
            StrictMode.SetThreadPolicy(policy);
        }