1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-24 18:41:06 +03:00

add @overide for subclass override method

This commit is contained in:
TangHuaiZhe
2019-03-30 12:42:26 +08:00
parent e2cfcb35ea
commit a7603602ca
4 changed files with 25 additions and 0 deletions

View File

@@ -30,38 +30,47 @@ public final class FakeSSLSession implements SSLSession {
this.certificates = certificates;
}
@Override
public int getApplicationBufferSize() {
throw new UnsupportedOperationException();
}
@Override
public String getCipherSuite() {
throw new UnsupportedOperationException();
}
@Override
public long getCreationTime() {
throw new UnsupportedOperationException();
}
@Override
public byte[] getId() {
throw new UnsupportedOperationException();
}
@Override
public long getLastAccessedTime() {
throw new UnsupportedOperationException();
}
@Override
public Certificate[] getLocalCertificates() {
throw new UnsupportedOperationException();
}
@Override
public Principal getLocalPrincipal() {
throw new UnsupportedOperationException();
}
@Override
public int getPacketBufferSize() {
throw new UnsupportedOperationException();
}
@Override
public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException {
if (certificates.length == 0) {
throw new SSLPeerUnverifiedException("peer not authenticated");
@@ -70,50 +79,62 @@ public final class FakeSSLSession implements SSLSession {
}
}
@Override
public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException {
throw new UnsupportedOperationException();
}
@Override
public String getPeerHost() {
throw new UnsupportedOperationException();
}
@Override
public int getPeerPort() {
throw new UnsupportedOperationException();
}
@Override
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
throw new UnsupportedOperationException();
}
@Override
public String getProtocol() {
throw new UnsupportedOperationException();
}
@Override
public SSLSessionContext getSessionContext() {
throw new UnsupportedOperationException();
}
@Override
public void putValue(String s, Object obj) {
throw new UnsupportedOperationException();
}
@Override
public void removeValue(String s) {
throw new UnsupportedOperationException();
}
@Override
public Object getValue(String s) {
throw new UnsupportedOperationException();
}
@Override
public String[] getValueNames() {
throw new UnsupportedOperationException();
}
@Override
public void invalidate() {
throw new UnsupportedOperationException();
}
@Override
public boolean isValid() {
throw new UnsupportedOperationException();
}

View File

@@ -31,6 +31,7 @@ public class OkHttpClientTestRule implements TestRule {
private Statement statement(final Statement base) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
base.evaluate();

View File

@@ -23,6 +23,7 @@ import javax.net.ssl.SSLSession;
public final class RecordingHostnameVerifier implements HostnameVerifier {
public final List<String> calls = new ArrayList<>();
@Override
public boolean verify(String hostname, SSLSession session) {
calls.add("verify " + hostname);
return true;

View File

@@ -167,6 +167,7 @@ public final class DiskLruCache implements Closeable, Flushable {
/** Used to run 'cleanupRunnable' for journal rebuilds. */
private final Executor executor;
private final Runnable cleanupRunnable = new Runnable() {
@Override
public void run() {
synchronized (DiskLruCache.this) {
if (!initialized | closed) {
@@ -814,6 +815,7 @@ public final class DiskLruCache implements Closeable, Flushable {
return lengths[index];
}
@Override
public void close() {
for (Source in : sources) {
Util.closeQuietly(in);