1OkHttp
2======
3
4An HTTP & SPDY client for Android and Java applications.
5
6For more information please see [the website][1].
7
8
9
10Download
11--------
12
13Download [the latest JAR][2] or grab via Maven:
14
15```xml
16<dependency>
17    <groupId>com.squareup.okhttp</groupId>
18    <artifactId>okhttp</artifactId>
19    <version>(insert latest version)</version>
20</dependency>
21```
22
23
24Building
25--------
26
27OkHttp requires Java 7 to build and run tests. Runtime compatibility with Java 6 is enforced as
28part of the build to ensure compliance with Android and older versions of the JVM.
29
30
31
32Testing
33-------
34
35### On the Desktop
36
37Run OkHttp tests on the desktop with Maven. Running SPDY tests on the desktop uses
38[Jetty-NPN][3] which requires OpenJDK 7+.
39
40```
41mvn clean test
42```
43
44### On a Device
45
46OkHttp's test suite creates an in-process HTTPS server. Prior to Android 2.3, SSL server sockets
47were broken, and so HTTPS tests will time out when run on such devices.
48
49Test on a USB-attached Android using [Vogar][4]. Unfortunately `dx` requires that you build with
50Java 6, otherwise the test class will be silently omitted from the `.dex` file.
51
52```
53mvn clean
54mvn package -DskipTests
55vogar \
56    --classpath ~/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar \
57    --classpath mockwebserver/target/mockwebserver-2.0.0-SNAPSHOT.jar \
58    --classpath okhttp-protocols/target/okhttp-protocols-2.0.0-SNAPSHOT.jar \
59    --classpath okhttp/target/okhttp-2.0.0-SNAPSHOT.jar \
60    okhttp/src/test
61```
62
63MockWebServer
64-------------
65
66A library for testing HTTP, HTTPS, HTTP/2.0, and SPDY clients.
67
68MockWebServer coupling with OkHttp is essential for proper testing of SPDY and HTTP/2.0 so that code can be shared.
69
70### Download
71
72Download [the latest JAR][5] or grab via Maven:
73
74```xml
75<dependency>
76    <groupId>com.squareup.okhttp</groupId>
77    <artifactId>mockwebserver</artifactId>
78    <version>(insert latest version)</version>
79    <scope>test</scope>
80</dependency>
81```
82
83
84License
85-------
86
87    Licensed under the Apache License, Version 2.0 (the "License");
88    you may not use this file except in compliance with the License.
89    You may obtain a copy of the License at
90
91       http://www.apache.org/licenses/LICENSE-2.0
92
93    Unless required by applicable law or agreed to in writing, software
94    distributed under the License is distributed on an "AS IS" BASIS,
95    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
96    See the License for the specific language governing permissions and
97    limitations under the License.
98
99
100
101
102 [1]: http://square.github.io/okhttp
103 [2]: http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.squareup.okhttp&a=okhttp&v=LATEST
104 [3]: http://wiki.eclipse.org/Jetty/Feature/NPN
105 [4]: https://code.google.com/p/vogar/
106 [5]: http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.squareup.okhttp&a=mockwebserver&v=LATEST
107