1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.spdy;
17
18 import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
19
20 import io.netty.util.internal.StringUtil;
21
22
23
24
25 public class DefaultSpdyGoAwayFrame implements SpdyGoAwayFrame {
26
27 private int lastGoodStreamId;
28 private SpdySessionStatus status;
29
30
31
32
33
34
35 public DefaultSpdyGoAwayFrame(int lastGoodStreamId) {
36 this(lastGoodStreamId, 0);
37 }
38
39
40
41
42
43
44
45 public DefaultSpdyGoAwayFrame(int lastGoodStreamId, int statusCode) {
46 this(lastGoodStreamId, SpdySessionStatus.valueOf(statusCode));
47 }
48
49
50
51
52
53
54
55 public DefaultSpdyGoAwayFrame(int lastGoodStreamId, SpdySessionStatus status) {
56 setLastGoodStreamId(lastGoodStreamId);
57 setStatus(status);
58 }
59
60 @Override
61 public int lastGoodStreamId() {
62 return lastGoodStreamId;
63 }
64
65 @Override
66 public SpdyGoAwayFrame setLastGoodStreamId(int lastGoodStreamId) {
67 checkPositiveOrZero(lastGoodStreamId, "lastGoodStreamId");
68 this.lastGoodStreamId = lastGoodStreamId;
69 return this;
70 }
71
72 @Override
73 public SpdySessionStatus status() {
74 return status;
75 }
76
77 @Override
78 public SpdyGoAwayFrame setStatus(SpdySessionStatus status) {
79 this.status = status;
80 return this;
81 }
82
83 @Override
84 public String toString() {
85 return new StringBuilder()
86 .append(StringUtil.simpleClassName(this))
87 .append(StringUtil.NEWLINE)
88 .append("--> Last-good-stream-ID = ")
89 .append(lastGoodStreamId())
90 .append(StringUtil.NEWLINE)
91 .append("--> Status: ")
92 .append(status())
93 .toString();
94 }
95 }