Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonlzy committed Jan 15, 2016
0 parents commit 548e0a5
Show file tree
Hide file tree
Showing 63 changed files with 2,674 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
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
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions app/build.gradle
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')
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
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 *;
#}
22 changes: 22 additions & 0 deletions app/src/main/AndroidManifest.xml
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>
Binary file added app/src/main/assets/srca.cer
Binary file not shown.
Binary file added app/src/main/assets/zhy_client.bks
Binary file not shown.
Binary file added app/src/main/assets/zhy_server.cer
Binary file not shown.
39 changes: 39 additions & 0 deletions app/src/main/java/com/lzy/okhttpdemo/Bean.java
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 + '\'' +
'}';
}
}
54 changes: 54 additions & 0 deletions app/src/main/java/com/lzy/okhttpdemo/GApp.java
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();
}
}
}
Loading

0 comments on commit 548e0a5

Please sign in to comment.