-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from square/jwilson/http2_or_spdy3
Support multiple variants of the SPDY protocol.
- Loading branch information
Showing
9 changed files
with
707 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft04.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
* Copyright (C) 2013 Square, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.squareup.okhttp.internal.spdy; | ||
|
||
import java.io.DataInputStream; | ||
import java.io.DataOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.util.List; | ||
|
||
final class Http20Draft04 implements Variant { | ||
@Override public SpdyReader newReader(InputStream in) { | ||
return new Reader(in); | ||
} | ||
|
||
@Override public SpdyWriter newWriter(OutputStream out) { | ||
return new Writer(out); | ||
} | ||
|
||
static final class Reader implements SpdyReader { | ||
private final DataInputStream in; | ||
|
||
Reader(InputStream in) { | ||
this.in = new DataInputStream(in); | ||
} | ||
|
||
@Override public boolean nextFrame(Handler handler) throws IOException { | ||
return false; | ||
} | ||
|
||
@Override public void close() throws IOException { | ||
in.close(); | ||
} | ||
} | ||
|
||
static final class Writer implements SpdyWriter { | ||
private final DataOutputStream out; | ||
|
||
Writer(OutputStream out) { | ||
this.out = new DataOutputStream(out); | ||
} | ||
|
||
@Override public synchronized void writeFrame(byte[] data, int offset, int length) | ||
throws IOException { | ||
// TODO: this method no longer makes sense; the raw frame can't support all variants! | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void flush() throws IOException { | ||
out.flush(); | ||
} | ||
|
||
@Override public synchronized void connectionHeader() { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void synStream(int flags, int streamId, int associatedStreamId, | ||
int priority, int slot, List<String> nameValueBlock) throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void synReply(int flags, int streamId, | ||
List<String> nameValueBlock) throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void headers(int flags, int streamId, List<String> nameValueBlock) | ||
throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void rstStream(int streamId, int statusCode) throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void data(int flags, int streamId, byte[] data) | ||
throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void settings(int flags, Settings settings) throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void noop() throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void ping(int flags, int id) throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void goAway(int flags, int lastGoodStreamId, int statusCode) | ||
throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public synchronized void windowUpdate(int streamId, int deltaWindowSize) | ||
throws IOException { | ||
throw new UnsupportedOperationException("TODO"); | ||
} | ||
|
||
@Override public void close() throws IOException { | ||
out.close(); | ||
} | ||
} | ||
} |
Oops, something went wrong.