-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.lzy.okhttpdemo" | ||
minSdkVersion 16 | ||
targetSdkVersion 22 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
compile 'com.android.support:appcompat-v7:23.1.1' | ||
compile project(':library_okhttputils') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in E:\Android\SDK/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest | ||
package="com.lzy.okhttpdemo" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<application | ||
android:name=".GApp" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.lzy.okhttpdemo; | ||
|
||
/** | ||
* ================================================ | ||
* 作 者:廖子尧 | ||
* 版 本:1.0 | ||
* 创建日期:2016/1/14 | ||
* 描 述: | ||
* 修订历史: | ||
* ================================================ | ||
*/ | ||
public class Bean { | ||
public String ip; | ||
public String host; | ||
public String port; | ||
public String connection; | ||
public String aaa; | ||
public String bbb; | ||
public String ccc; | ||
public String xxx; | ||
public String yyy; | ||
public String zzz; | ||
|
||
@Override | ||
public String toString() { | ||
return "Bean{" + | ||
"ip='" + ip + '\'' + | ||
", host='" + host + '\'' + | ||
", port='" + port + '\'' + | ||
", connection='" + connection + '\'' + | ||
", aaa='" + aaa + '\'' + | ||
", bbb='" + bbb + '\'' + | ||
", ccc='" + ccc + '\'' + | ||
", xxx='" + xxx + '\'' + | ||
", yyy='" + yyy + '\'' + | ||
", zzz='" + zzz + '\'' + | ||
'}'; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.lzy.okhttpdemo; | ||
|
||
import android.app.Application; | ||
|
||
import com.lzy.okhttputils.OkHttpUtils; | ||
|
||
import okio.Buffer; | ||
|
||
/** | ||
* ================================================ | ||
* 作 者:廖子尧 | ||
* 版 本:1.0 | ||
* 创建日期:2015/9/23 | ||
* 描 述: | ||
* 修订历史: | ||
* ================================================ | ||
*/ | ||
public class GApp extends Application { | ||
|
||
private static final String CER_12306 = "-----BEGIN CERTIFICATE-----\n" + | ||
"MIICmjCCAgOgAwIBAgIIbyZr5/jKH6QwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ04xKTAn\n" + | ||
"BgNVBAoTIFNpbm9yYWlsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRTUkNBMB4X\n" + | ||
"DTA5MDUyNTA2NTYwMFoXDTI5MDUyMDA2NTYwMFowRzELMAkGA1UEBhMCQ04xKTAnBgNVBAoTIFNp\n" + | ||
"bm9yYWlsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRTUkNBMIGfMA0GCSqGSIb3\n" + | ||
"DQEBAQUAA4GNADCBiQKBgQDMpbNeb34p0GvLkZ6t72/OOba4mX2K/eZRWFfnuk8e5jKDH+9BgCb2\n" + | ||
"9bSotqPqTbxXWPxIOz8EjyUO3bfR5pQ8ovNTOlks2rS5BdMhoi4sUjCKi5ELiqtyww/XgY5iFqv6\n" + | ||
"D4Pw9QvOUcdRVSbPWo1DwMmH75It6pk/rARIFHEjWwIDAQABo4GOMIGLMB8GA1UdIwQYMBaAFHle\n" + | ||
"tne34lKDQ+3HUYhMY4UsAENYMAwGA1UdEwQFMAMBAf8wLgYDVR0fBCcwJTAjoCGgH4YdaHR0cDov\n" + | ||
"LzE5Mi4xNjguOS4xNDkvY3JsMS5jcmwwCwYDVR0PBAQDAgH+MB0GA1UdDgQWBBR5XrZ3t+JSg0Pt\n" + | ||
"x1GITGOFLABDWDANBgkqhkiG9w0BAQUFAAOBgQDGrAm2U/of1LbOnG2bnnQtgcVaBXiVJF8LKPaV\n" + | ||
"23XQ96HU8xfgSZMJS6U00WHAI7zp0q208RSUft9wDq9ee///VOhzR6Tebg9QfyPSohkBrhXQenvQ\n" + | ||
"og555S+C3eJAAVeNCTeMS3N/M5hzBRJAoffn3qoYdAO1Q8bTguOi+2849A==\n" + | ||
"-----END CERTIFICATE-----"; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
System.setProperty("http.proxyHost", "192.168.1.111"); | ||
System.setProperty("http.proxyPort", "8888"); | ||
|
||
OkHttpUtils.debug(true, "MyOkHttp"); | ||
try { | ||
OkHttpUtils.getInstance()// | ||
.setConnectTimeout(OkHttpUtils.DEFAULT_MILLISECONDS)// | ||
.setReadTimeOut(OkHttpUtils.DEFAULT_MILLISECONDS)// | ||
// .setCertificates(getAssets().open("srca.cer"), getAssets().open("zhy_server"))// | ||
.setCertificates(new Buffer().writeUtf8(CER_12306).inputStream())// | ||
.setWriteTimeOut(OkHttpUtils.DEFAULT_MILLISECONDS); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |