Do not use the deprecated methods (#393)
This commit is contained in:
parent
9464396719
commit
178d24a16d
@ -138,8 +138,8 @@ public class SpdyFrameEncoder extends OneToOneEncoder {
|
|||||||
frame.writeShort(SPDY_SYN_STREAM_FRAME);
|
frame.writeShort(SPDY_SYN_STREAM_FRAME);
|
||||||
frame.writeByte(flags);
|
frame.writeByte(flags);
|
||||||
frame.writeMedium(length);
|
frame.writeMedium(length);
|
||||||
frame.writeInt(spdySynStreamFrame.getStreamID());
|
frame.writeInt(spdySynStreamFrame.getStreamId());
|
||||||
frame.writeInt(spdySynStreamFrame.getAssociatedToStreamID());
|
frame.writeInt(spdySynStreamFrame.getAssociatedToStreamId());
|
||||||
if (version < 3) {
|
if (version < 3) {
|
||||||
// Restrict priorities for SPDY/2 to between 0 and 3
|
// Restrict priorities for SPDY/2 to between 0 and 3
|
||||||
byte priority = spdySynStreamFrame.getPriority();
|
byte priority = spdySynStreamFrame.getPriority();
|
||||||
@ -253,7 +253,7 @@ public class SpdyFrameEncoder extends OneToOneEncoder {
|
|||||||
frame.writeShort(version | 0x8000);
|
frame.writeShort(version | 0x8000);
|
||||||
frame.writeShort(SPDY_PING_FRAME);
|
frame.writeShort(SPDY_PING_FRAME);
|
||||||
frame.writeInt(4);
|
frame.writeInt(4);
|
||||||
frame.writeInt(spdyPingFrame.getID());
|
frame.writeInt(spdyPingFrame.getId());
|
||||||
return frame;
|
return frame;
|
||||||
|
|
||||||
} else if (msg instanceof SpdyGoAwayFrame) {
|
} else if (msg instanceof SpdyGoAwayFrame) {
|
||||||
|
@ -89,11 +89,11 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
|||||||
|
|
||||||
// HTTP requests/responses are mapped one-to-one to SPDY streams.
|
// HTTP requests/responses are mapped one-to-one to SPDY streams.
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
|
|
||||||
if (SpdyCodecUtil.isServerID(streamID)) {
|
if (SpdyCodecUtil.isServerID(streamID)) {
|
||||||
// SYN_STREAM frames initiated by the server are pushed resources
|
// SYN_STREAM frames initiated by the server are pushed resources
|
||||||
int associatedToStreamID = spdySynStreamFrame.getAssociatedToStreamID();
|
int associatedToStreamID = spdySynStreamFrame.getAssociatedToStreamId();
|
||||||
|
|
||||||
// If a client receives a SYN_STREAM with an Associated-To-Stream-ID of 0
|
// If a client receives a SYN_STREAM with an Associated-To-Stream-ID of 0
|
||||||
// it must reply with a RST_STREAM with error code INVALID_STREAM
|
// it must reply with a RST_STREAM with error code INVALID_STREAM
|
||||||
|
@ -164,7 +164,7 @@ public class SpdyHttpEncoder implements ChannelDownstreamHandler {
|
|||||||
|
|
||||||
HttpRequest httpRequest = (HttpRequest) msg;
|
HttpRequest httpRequest = (HttpRequest) msg;
|
||||||
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpRequest);
|
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpRequest);
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
ChannelFuture future = getContentFuture(ctx, e, streamID, httpRequest);
|
ChannelFuture future = getContentFuture(ctx, e, streamID, httpRequest);
|
||||||
Channels.write(ctx, future, spdySynStreamFrame, e.getRemoteAddress());
|
Channels.write(ctx, future, spdySynStreamFrame, e.getRemoteAddress());
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ public class SpdyHttpEncoder implements ChannelDownstreamHandler {
|
|||||||
HttpResponse httpResponse = (HttpResponse) msg;
|
HttpResponse httpResponse = (HttpResponse) msg;
|
||||||
if (httpResponse.containsHeader(SpdyHttpHeaders.Names.ASSOCIATED_TO_STREAM_ID)) {
|
if (httpResponse.containsHeader(SpdyHttpHeaders.Names.ASSOCIATED_TO_STREAM_ID)) {
|
||||||
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpResponse);
|
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpResponse);
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
ChannelFuture future = getContentFuture(ctx, e, streamID, httpResponse);
|
ChannelFuture future = getContentFuture(ctx, e, streamID, httpResponse);
|
||||||
Channels.write(ctx, future, spdySynStreamFrame, e.getRemoteAddress());
|
Channels.write(ctx, future, spdySynStreamFrame, e.getRemoteAddress());
|
||||||
} else {
|
} else {
|
||||||
|
@ -215,7 +215,7 @@ public class SpdySessionHandler extends SimpleChannelUpstreamHandler
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
|
|
||||||
// Check if we received a valid SYN_STREAM frame
|
// Check if we received a valid SYN_STREAM frame
|
||||||
if (spdySynStreamFrame.isInvalid() ||
|
if (spdySynStreamFrame.isInvalid() ||
|
||||||
@ -326,7 +326,7 @@ public class SpdySessionHandler extends SimpleChannelUpstreamHandler
|
|||||||
|
|
||||||
SpdyPingFrame spdyPingFrame = (SpdyPingFrame) msg;
|
SpdyPingFrame spdyPingFrame = (SpdyPingFrame) msg;
|
||||||
|
|
||||||
if (isRemoteInitiatedID(spdyPingFrame.getID())) {
|
if (isRemoteInitiatedID(spdyPingFrame.getId())) {
|
||||||
Channels.write(ctx, Channels.future(e.getChannel()), spdyPingFrame, e.getRemoteAddress());
|
Channels.write(ctx, Channels.future(e.getChannel()), spdyPingFrame, e.getRemoteAddress());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ public class SpdySessionHandler extends SimpleChannelUpstreamHandler
|
|||||||
} else if (msg instanceof SpdySynStreamFrame) {
|
} else if (msg instanceof SpdySynStreamFrame) {
|
||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
|
|
||||||
if (isRemoteInitiatedID(streamID)) {
|
if (isRemoteInitiatedID(streamID)) {
|
||||||
e.getFuture().setFailure(PROTOCOL_EXCEPTION);
|
e.getFuture().setFailure(PROTOCOL_EXCEPTION);
|
||||||
@ -595,9 +595,9 @@ public class SpdySessionHandler extends SimpleChannelUpstreamHandler
|
|||||||
} else if (msg instanceof SpdyPingFrame) {
|
} else if (msg instanceof SpdyPingFrame) {
|
||||||
|
|
||||||
SpdyPingFrame spdyPingFrame = (SpdyPingFrame) msg;
|
SpdyPingFrame spdyPingFrame = (SpdyPingFrame) msg;
|
||||||
if (isRemoteInitiatedID(spdyPingFrame.getID())) {
|
if (isRemoteInitiatedID(spdyPingFrame.getId())) {
|
||||||
e.getFuture().setFailure(new IllegalArgumentException(
|
e.getFuture().setFailure(new IllegalArgumentException(
|
||||||
"invalid PING ID: " + spdyPingFrame.getID()));
|
"invalid PING ID: " + spdyPingFrame.getId()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pings.getAndIncrement();
|
pings.getAndIncrement();
|
||||||
|
@ -79,7 +79,7 @@ public class SpdySessionHandlerTest {
|
|||||||
Assert.assertNotNull(msg);
|
Assert.assertNotNull(msg);
|
||||||
Assert.assertTrue(msg instanceof SpdyPingFrame);
|
Assert.assertTrue(msg instanceof SpdyPingFrame);
|
||||||
SpdyPingFrame spdyPingFrame = (SpdyPingFrame) msg;
|
SpdyPingFrame spdyPingFrame = (SpdyPingFrame) msg;
|
||||||
Assert.assertTrue(spdyPingFrame.getID() == ID);
|
Assert.assertTrue(spdyPingFrame.getId() == ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertGoAway(Object msg, int lastGoodStreamID) {
|
private static void assertGoAway(Object msg, int lastGoodStreamID) {
|
||||||
@ -153,7 +153,7 @@ public class SpdySessionHandlerTest {
|
|||||||
// Check if session handler closed the streams using the number
|
// Check if session handler closed the streams using the number
|
||||||
// of concurrent streams and that it returns REFUSED_STREAM
|
// of concurrent streams and that it returns REFUSED_STREAM
|
||||||
// if it receives a SYN_STREAM frame it does not wish to accept
|
// if it receives a SYN_STREAM frame it does not wish to accept
|
||||||
spdySynStreamFrame.setStreamID(localStreamID);
|
spdySynStreamFrame.setStreamId(localStreamID);
|
||||||
spdySynStreamFrame.setLast(true);
|
spdySynStreamFrame.setLast(true);
|
||||||
spdySynStreamFrame.setUnidirectional(true);
|
spdySynStreamFrame.setUnidirectional(true);
|
||||||
sessionHandler.offer(spdySynStreamFrame);
|
sessionHandler.offer(spdySynStreamFrame);
|
||||||
@ -181,11 +181,11 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
// Check if session handler returns PROTOCOL_ERROR if it receives
|
// Check if session handler returns PROTOCOL_ERROR if it receives
|
||||||
// a SYN_STREAM frame with an invalid Stream-ID
|
// a SYN_STREAM frame with an invalid Stream-ID
|
||||||
spdySynStreamFrame.setStreamID(localStreamID - 1);
|
spdySynStreamFrame.setStreamId(localStreamID - 1);
|
||||||
sessionHandler.offer(spdySynStreamFrame);
|
sessionHandler.offer(spdySynStreamFrame);
|
||||||
assertRstStream(sessionHandler.poll(), localStreamID - 1, SpdyStreamStatus.PROTOCOL_ERROR);
|
assertRstStream(sessionHandler.poll(), localStreamID - 1, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
Assert.assertNull(sessionHandler.peek());
|
Assert.assertNull(sessionHandler.peek());
|
||||||
spdySynStreamFrame.setStreamID(localStreamID);
|
spdySynStreamFrame.setStreamId(localStreamID);
|
||||||
|
|
||||||
// Check if session handler correctly limits the number of
|
// Check if session handler correctly limits the number of
|
||||||
// concurrent streams in the SETTINGS frame
|
// concurrent streams in the SETTINGS frame
|
||||||
@ -223,7 +223,7 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
// Check if session handler returns identical local PINGs
|
// Check if session handler returns identical local PINGs
|
||||||
sessionHandler.offer(localPingFrame);
|
sessionHandler.offer(localPingFrame);
|
||||||
assertPing(sessionHandler.poll(), localPingFrame.getID());
|
assertPing(sessionHandler.poll(), localPingFrame.getId());
|
||||||
Assert.assertNull(sessionHandler.peek());
|
Assert.assertNull(sessionHandler.peek());
|
||||||
|
|
||||||
// Check if session handler ignores un-initiated remote PINGs
|
// Check if session handler ignores un-initiated remote PINGs
|
||||||
@ -238,7 +238,7 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
// Check if session handler returns REFUSED_STREAM if it receives
|
// Check if session handler returns REFUSED_STREAM if it receives
|
||||||
// SYN_STREAM frames after sending a GOAWAY frame
|
// SYN_STREAM frames after sending a GOAWAY frame
|
||||||
spdySynStreamFrame.setStreamID(localStreamID);
|
spdySynStreamFrame.setStreamId(localStreamID);
|
||||||
sessionHandler.offer(spdySynStreamFrame);
|
sessionHandler.offer(spdySynStreamFrame);
|
||||||
assertRstStream(sessionHandler.poll(), localStreamID, SpdyStreamStatus.REFUSED_STREAM);
|
assertRstStream(sessionHandler.poll(), localStreamID, SpdyStreamStatus.REFUSED_STREAM);
|
||||||
Assert.assertNull(sessionHandler.peek());
|
Assert.assertNull(sessionHandler.peek());
|
||||||
@ -288,11 +288,11 @@ public class SpdySessionHandlerTest {
|
|||||||
new DefaultSpdySynStreamFrame(streamID, 0, (byte) 0);
|
new DefaultSpdySynStreamFrame(streamID, 0, (byte) 0);
|
||||||
spdySynStreamFrame.setLast(true);
|
spdySynStreamFrame.setLast(true);
|
||||||
Channels.write(e.getChannel(), spdySynStreamFrame);
|
Channels.write(e.getChannel(), spdySynStreamFrame);
|
||||||
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
|
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
|
||||||
Channels.write(e.getChannel(), spdySynStreamFrame);
|
Channels.write(e.getChannel(), spdySynStreamFrame);
|
||||||
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
|
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
|
||||||
Channels.write(e.getChannel(), spdySynStreamFrame);
|
Channels.write(e.getChannel(), spdySynStreamFrame);
|
||||||
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
|
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
|
||||||
Channels.write(e.getChannel(), spdySynStreamFrame);
|
Channels.write(e.getChannel(), spdySynStreamFrame);
|
||||||
|
|
||||||
// Limit the number of concurrent streams to 3
|
// Limit the number of concurrent streams to 3
|
||||||
@ -317,7 +317,7 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
|
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
SpdySynReplyFrame spdySynReplyFrame = new DefaultSpdySynReplyFrame(streamID);
|
SpdySynReplyFrame spdySynReplyFrame = new DefaultSpdySynReplyFrame(streamID);
|
||||||
spdySynReplyFrame.setLast(spdySynStreamFrame.isLast());
|
spdySynReplyFrame.setLast(spdySynStreamFrame.isLast());
|
||||||
for (Map.Entry<String, String> entry: spdySynStreamFrame.getHeaders()) {
|
for (Map.Entry<String, String> entry: spdySynStreamFrame.getHeaders()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user