mirror of
https://github.com/square/okhttp.git
synced 2026-01-25 16:01:38 +03:00
Move out of the libcore package.
To promote the code into AOSP, we'll keep this package as-is and do the jarjar in Android instead.
This commit is contained in:
25
pom.xml
25
pom.xml
@@ -101,31 +101,6 @@
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>jarjar-maven-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jarjar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>asm:asm</include>
|
||||
<include>org.sonatype.sisu.inject:cglib</include>
|
||||
</includes>
|
||||
<rules>
|
||||
<rule>
|
||||
<pattern>libcore.**</pattern>
|
||||
<result>com.squareup.okhttp.libcore.@1</result>
|
||||
</rule>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.squareup.okhttp;
|
||||
|
||||
import com.squareup.okhttp.internal.net.http.HttpURLConnectionImpl;
|
||||
import com.squareup.okhttp.internal.net.http.HttpsURLConnectionImpl;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
@@ -33,9 +35,9 @@ public final class OkHttpClient {
|
||||
public HttpURLConnection open(URL url) {
|
||||
String protocol = url.getProtocol();
|
||||
if (protocol.equals("http")) {
|
||||
return new libcore.net.http.HttpURLConnectionImpl(url, 80, proxy);
|
||||
return new HttpURLConnectionImpl(url, 80, proxy);
|
||||
} else if (protocol.equals("https")) {
|
||||
return new libcore.net.http.HttpsURLConnectionImpl(url, 443, proxy);
|
||||
return new HttpsURLConnectionImpl(url, 443, proxy);
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore;
|
||||
package com.squareup.okhttp.internal;
|
||||
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import java.io.OutputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
* @author Alexander Y. Kleymenov
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import com.squareup.okhttp.internal.util.EmptyArray;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import libcore.util.EmptyArray;
|
||||
|
||||
/**
|
||||
* <a href="http://www.ietf.org/rfc/rfc2045.txt">Base64</a> encoder/decoder.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
/**
|
||||
* Iterates over big- or little-endian bytes. See {@link MemoryMappedFile#bigEndianIterator} and
|
||||
@@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Charsets;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.Closeable;
|
||||
import java.io.EOFException;
|
||||
@@ -41,8 +43,6 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import libcore.util.Charsets;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
/**
|
||||
* A cache that uses a bounded amount of space on a filesystem. Each cache
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
public final class OsConstants {
|
||||
private OsConstants() { }
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
public final class SizeOf {
|
||||
public static final int CHAR = 2;
|
||||
@@ -14,8 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
@@ -24,7 +25,6 @@ import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
public final class Streams {
|
||||
private static AtomicReference<byte[]> skipBuffer = new AtomicReference<byte[]>();
|
||||
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Charsets;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import libcore.util.Charsets;
|
||||
|
||||
/**
|
||||
* Buffers input from an {@link InputStream} for reading lines.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net;
|
||||
package com.squareup.okhttp.internal.net;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net;
|
||||
package com.squareup.okhttp.internal.net;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.CacheRequest;
|
||||
import libcore.io.Streams;
|
||||
|
||||
/**
|
||||
* An input stream for the body of an HTTP response.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
final class HeaderParser {
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import static com.squareup.okhttp.OkHttpConnection.HTTP_PROXY_AUTH;
|
||||
import static com.squareup.okhttp.OkHttpConnection.HTTP_UNAUTHORIZED;
|
||||
import com.squareup.okhttp.internal.io.Base64;
|
||||
import java.io.IOException;
|
||||
import java.net.Authenticator;
|
||||
import static java.net.HttpURLConnection.HTTP_PROXY_AUTH;
|
||||
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PasswordAuthentication;
|
||||
@@ -27,7 +28,6 @@ import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import libcore.io.Base64;
|
||||
|
||||
/**
|
||||
* Handles HTTP authentication headers from origin and proxy servers.
|
||||
@@ -15,14 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import static com.squareup.okhttp.OkHttpConnection.HTTP_PROXY_AUTH;
|
||||
import com.squareup.okhttp.internal.Platform;
|
||||
import com.squareup.okhttp.internal.io.IoUtils;
|
||||
import com.squareup.okhttp.internal.net.spdy.SpdyConnection;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import com.squareup.okhttp.internal.util.Objects;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import static java.net.HttpURLConnection.HTTP_OK;
|
||||
import static java.net.HttpURLConnection.HTTP_PROXY_AUTH;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.Socket;
|
||||
@@ -33,11 +38,6 @@ import java.util.Arrays;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import libcore.Platform;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.net.spdy.SpdyConnection;
|
||||
import libcore.util.Libcore;
|
||||
import libcore.util.Objects;
|
||||
|
||||
/**
|
||||
* Holds the sockets and streams of an HTTP, HTTPS, or HTTPS+SPDY connection,
|
||||
@@ -15,14 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
/**
|
||||
* A pool of HTTP and SPDY connections. This class exposes its tuning parameters
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
@@ -15,8 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.io.IoUtils;
|
||||
import com.squareup.okhttp.internal.net.Dns;
|
||||
import com.squareup.okhttp.internal.util.EmptyArray;
|
||||
import com.squareup.okhttp.internal.util.ExtendedResponseCache;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import com.squareup.okhttp.internal.util.ResponseSource;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -39,12 +45,6 @@ import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.net.Dns;
|
||||
import libcore.util.EmptyArray;
|
||||
import libcore.util.ExtendedResponseCache;
|
||||
import libcore.util.Libcore;
|
||||
import libcore.util.ResponseSource;
|
||||
|
||||
/**
|
||||
* Handles a single HTTP request/response pair. Each HTTP engine follows this
|
||||
@@ -14,8 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Base64;
|
||||
import com.squareup.okhttp.internal.io.DiskLruCache;
|
||||
import com.squareup.okhttp.internal.io.IoUtils;
|
||||
import com.squareup.okhttp.internal.io.StrictLineReader;
|
||||
import com.squareup.okhttp.internal.util.Charsets;
|
||||
import com.squareup.okhttp.internal.util.ExtendedResponseCache;
|
||||
import com.squareup.okhttp.internal.util.IntegralToString;
|
||||
import com.squareup.okhttp.internal.util.ResponseSource;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
@@ -47,14 +55,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLPeerUnverifiedException;
|
||||
import libcore.io.Base64;
|
||||
import libcore.io.DiskLruCache;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.StrictLineReader;
|
||||
import libcore.util.Charsets;
|
||||
import libcore.util.ExtendedResponseCache;
|
||||
import libcore.util.IntegralToString;
|
||||
import libcore.util.ResponseSource;
|
||||
|
||||
/**
|
||||
* Cache responses in a directory on the file system. Most clients should use
|
||||
@@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -25,8 +27,6 @@ import java.net.CacheRequest;
|
||||
import java.net.CookieHandler;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.Socket;
|
||||
import libcore.io.Streams;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
final class HttpTransport implements Transport {
|
||||
/**
|
||||
@@ -15,8 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.io.IoUtils;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -33,8 +35,6 @@ import java.security.cert.CertificateException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
/**
|
||||
* This implementation uses HttpEngine to send requests and receive responses.
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Proxy;
|
||||
@@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -15,8 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -31,8 +33,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import libcore.io.Streams;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
/**
|
||||
* The HTTP status and unparsed header fields of a single HTTP message. Values
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
@@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Objects;
|
||||
import com.squareup.okhttp.internal.util.ResponseSource;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
@@ -26,8 +28,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import libcore.util.Objects;
|
||||
import libcore.util.ResponseSource;
|
||||
|
||||
/**
|
||||
* Parsed HTTP response headers.
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.ProtocolException;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
/**
|
||||
* An HTTP request body that's completely buffered in memory. This allows
|
||||
@@ -13,8 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.net.Dns;
|
||||
import static com.squareup.okhttp.internal.net.http.HttpConnection.TLS_MODE_AGGRESSIVE;
|
||||
import static com.squareup.okhttp.internal.net.http.HttpConnection.TLS_MODE_COMPATIBLE;
|
||||
import static com.squareup.okhttp.internal.net.http.HttpConnection.TLS_MODE_NULL;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -26,11 +31,6 @@ import java.net.UnknownHostException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import libcore.net.Dns;
|
||||
import static libcore.net.http.HttpConnection.TLS_MODE_AGGRESSIVE;
|
||||
import static libcore.net.http.HttpConnection.TLS_MODE_COMPATIBLE;
|
||||
import static libcore.net.http.HttpConnection.TLS_MODE_NULL;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
/**
|
||||
* Selects routes to connect to an origin server. Each connection requires a
|
||||
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.net.spdy.SpdyConnection;
|
||||
import com.squareup.okhttp.internal.net.spdy.SpdyStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.CacheRequest;
|
||||
import java.util.List;
|
||||
import libcore.net.spdy.SpdyConnection;
|
||||
import libcore.net.spdy.SpdyStream;
|
||||
|
||||
final class SpdyTransport implements Transport {
|
||||
private final HttpEngine httpEngine;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
final class Settings {
|
||||
/** Peer request to clear durable settings. */
|
||||
@@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import static com.squareup.okhttp.internal.net.spdy.Threads.newThreadFactory;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -29,9 +31,6 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import libcore.io.Streams;
|
||||
|
||||
import static libcore.net.spdy.Threads.newThreadFactory;
|
||||
|
||||
/**
|
||||
* A socket connection to a remote peer. A connection hosts streams which can
|
||||
@@ -14,8 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
@@ -27,7 +28,6 @@ import java.util.logging.Logger;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
import libcore.io.Streams;
|
||||
|
||||
/**
|
||||
* Read version 2 SPDY frames.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -14,17 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import com.squareup.okhttp.internal.util.Libcore;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import libcore.io.Streams;
|
||||
import libcore.util.Libcore;
|
||||
|
||||
import static java.nio.ByteOrder.BIG_ENDIAN;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A logical bidirectional stream.
|
||||
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import com.squareup.okhttp.internal.Platform;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.zip.Deflater;
|
||||
import libcore.Platform;
|
||||
|
||||
/**
|
||||
* Write version 2 SPDY frames.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.util.Collections;
|
||||
@@ -14,14 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
import com.squareup.okhttp.internal.net.MimeUtils;
|
||||
import java.net.FileNameMap;
|
||||
import java.util.Locale;
|
||||
import libcore.net.MimeUtils;
|
||||
|
||||
/**
|
||||
* Implements {@link java.net.FileNameMap} in terms of {@link libcore.net.MimeUtils}.
|
||||
* Implements {@link java.net.FileNameMap} in terms of
|
||||
* {@link com.squareup.okhttp.internal.net.MimeUtils}.
|
||||
*/
|
||||
class DefaultFileNameMap implements FileNameMap {
|
||||
public String getContentTypeFor(String filename) {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class EmptyArray {
|
||||
private EmptyArray() {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.CacheResponse;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
/**
|
||||
* Converts integral types to strings. This class is public but hidden so that it can also be
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableBoolean {
|
||||
public boolean value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableByte {
|
||||
public byte value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableChar {
|
||||
public char value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableDouble {
|
||||
public double value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableFloat {
|
||||
public float value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableInt {
|
||||
public int value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableLong {
|
||||
public long value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class MutableShort {
|
||||
public short value;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
public final class Objects {
|
||||
private Objects() {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
/**
|
||||
* Where the HTTP client should look for a response.
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.util;
|
||||
package com.squareup.okhttp.internal.util;
|
||||
|
||||
/**
|
||||
* Exploits a weakness in the runtime to throw an arbitrary throwable without
|
||||
@@ -14,8 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import static com.squareup.okhttp.internal.io.DiskLruCache.JOURNAL_FILE;
|
||||
import static com.squareup.okhttp.internal.io.DiskLruCache.MAGIC;
|
||||
import static com.squareup.okhttp.internal.io.DiskLruCache.VERSION_1;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
@@ -29,10 +32,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import static libcore.io.DiskLruCache.JOURNAL_FILE;
|
||||
import static libcore.io.DiskLruCache.MAGIC;
|
||||
import static libcore.io.DiskLruCache.VERSION_1;
|
||||
|
||||
public final class DiskLruCacheTest extends TestCase {
|
||||
private final int appVersion = 100;
|
||||
private String javaTmpDir;
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.io;
|
||||
package com.squareup.okhttp.internal.io;
|
||||
|
||||
import com.squareup.okhttp.internal.util.Charsets;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import junit.framework.TestCase;
|
||||
import libcore.util.Charsets;
|
||||
|
||||
public class StrictLineReaderTest extends TestCase {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import java.io.BufferedReader;
|
||||
@@ -14,11 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.google.mockwebserver.MockResponse;
|
||||
import com.google.mockwebserver.MockWebServer;
|
||||
import com.google.mockwebserver.RecordedRequest;
|
||||
import static com.google.mockwebserver.SocketPolicy.DISCONNECT_AT_END;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -58,8 +59,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import static com.google.mockwebserver.SocketPolicy.DISCONNECT_AT_END;
|
||||
|
||||
/**
|
||||
* Android's HttpResponseCacheTest.
|
||||
*/
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -13,8 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.squareup.okhttp.internal.net.Dns;
|
||||
import static com.squareup.okhttp.internal.net.http.HttpConnection.TLS_MODE_AGGRESSIVE;
|
||||
import static com.squareup.okhttp.internal.net.http.HttpConnection.TLS_MODE_COMPATIBLE;
|
||||
import com.squareup.okhttp.internal.net.ssl.SslContextBuilder;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -32,10 +36,6 @@ import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import junit.framework.TestCase;
|
||||
import libcore.net.Dns;
|
||||
import static libcore.net.http.HttpConnection.TLS_MODE_AGGRESSIVE;
|
||||
import static libcore.net.http.HttpConnection.TLS_MODE_COMPATIBLE;
|
||||
import libcore.net.ssl.SslContextBuilder;
|
||||
|
||||
public final class RouteSelectorTest extends TestCase {
|
||||
private static final int proxyAPort = 1001;
|
||||
@@ -14,13 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.http;
|
||||
package com.squareup.okhttp.internal.net.http;
|
||||
|
||||
import com.google.mockwebserver.MockResponse;
|
||||
import com.google.mockwebserver.MockWebServer;
|
||||
import com.google.mockwebserver.RecordedRequest;
|
||||
import com.google.mockwebserver.SocketPolicy;
|
||||
import static com.google.mockwebserver.SocketPolicy.DISCONNECT_AT_END;
|
||||
import static com.google.mockwebserver.SocketPolicy.DISCONNECT_AT_START;
|
||||
import static com.google.mockwebserver.SocketPolicy.SHUTDOWN_INPUT_AT_END;
|
||||
import static com.google.mockwebserver.SocketPolicy.SHUTDOWN_OUTPUT_AT_END;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import com.squareup.okhttp.internal.net.ssl.SslContextBuilder;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -69,12 +74,6 @@ import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import junit.framework.TestCase;
|
||||
import libcore.net.ssl.SslContextBuilder;
|
||||
|
||||
import static com.google.mockwebserver.SocketPolicy.DISCONNECT_AT_END;
|
||||
import static com.google.mockwebserver.SocketPolicy.DISCONNECT_AT_START;
|
||||
import static com.google.mockwebserver.SocketPolicy.SHUTDOWN_INPUT_AT_END;
|
||||
import static com.google.mockwebserver.SocketPolicy.SHUTDOWN_OUTPUT_AT_END;
|
||||
|
||||
/**
|
||||
* Android's URLConnectionTest.
|
||||
@@ -14,8 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import com.squareup.okhttp.internal.io.Streams;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -29,7 +30,6 @@ import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import libcore.io.Streams;
|
||||
|
||||
/**
|
||||
* Replays prerecorded outgoing frames and records incoming frames.
|
||||
@@ -13,17 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.DOWNLOAD_BANDWIDTH;
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.DOWNLOAD_RETRANS_RATE;
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.MAX_CONCURRENT_STREAMS;
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.PERSISTED;
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.PERSIST_VALUE;
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.UPLOAD_BANDWIDTH;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import static libcore.net.spdy.Settings.DOWNLOAD_BANDWIDTH;
|
||||
import static libcore.net.spdy.Settings.DOWNLOAD_RETRANS_RATE;
|
||||
import static libcore.net.spdy.Settings.MAX_CONCURRENT_STREAMS;
|
||||
import static libcore.net.spdy.Settings.PERSISTED;
|
||||
import static libcore.net.spdy.Settings.PERSIST_VALUE;
|
||||
import static libcore.net.spdy.Settings.UPLOAD_BANDWIDTH;
|
||||
|
||||
public final class SettingsTest extends TestCase {
|
||||
public void testUnsetField() {
|
||||
Settings settings = new Settings();
|
||||
@@ -14,8 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.spdy;
|
||||
package com.squareup.okhttp.internal.net.spdy;
|
||||
|
||||
import static com.squareup.okhttp.internal.net.spdy.Settings.PERSIST_VALUE;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.FLAG_FIN;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.TYPE_DATA;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.TYPE_NOOP;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.TYPE_PING;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.TYPE_RST_STREAM;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.TYPE_SYN_REPLY;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyConnection.TYPE_SYN_STREAM;
|
||||
import static com.squareup.okhttp.internal.net.spdy.SpdyStream.RST_INVALID_STREAM;
|
||||
import static com.squareup.okhttp.internal.util.Charsets.UTF_8;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -25,17 +35,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import static libcore.net.spdy.Settings.PERSIST_VALUE;
|
||||
import static libcore.net.spdy.SpdyConnection.FLAG_FIN;
|
||||
import static libcore.net.spdy.SpdyConnection.TYPE_DATA;
|
||||
import static libcore.net.spdy.SpdyConnection.TYPE_NOOP;
|
||||
import static libcore.net.spdy.SpdyConnection.TYPE_PING;
|
||||
import static libcore.net.spdy.SpdyConnection.TYPE_RST_STREAM;
|
||||
import static libcore.net.spdy.SpdyConnection.TYPE_SYN_REPLY;
|
||||
import static libcore.net.spdy.SpdyConnection.TYPE_SYN_STREAM;
|
||||
import static libcore.net.spdy.SpdyStream.RST_INVALID_STREAM;
|
||||
import static libcore.util.Charsets.UTF_8;
|
||||
|
||||
public final class SpdyConnectionTest extends TestCase {
|
||||
private static final IncomingStreamHandler REJECT_INCOMING_STREAMS
|
||||
= new IncomingStreamHandler() {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package libcore.net.ssl;
|
||||
package com.squareup.okhttp.internal.net.ssl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
Reference in New Issue
Block a user