Skip to content

Commit 4cd8258

Browse files
committed
Allow customization of the WebSocketUpgradeHandler
1 parent d4f8943 commit 4cd8258

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/java/com/ning/http/client/websocket/WebSocketUpgradeHandler.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class WebSocketUpgradeHandler implements UpgradeHandler<WebSocket>, Async
3333
private final long maxTextSize;
3434
private final AtomicBoolean ok = new AtomicBoolean(false);
3535

36-
private WebSocketUpgradeHandler(Builder b) {
36+
protected WebSocketUpgradeHandler(Builder b) {
3737
l = b.l;
3838
protocol = b.protocol;
3939
maxByteSize = b.maxByteSize;
@@ -44,23 +44,23 @@ private WebSocketUpgradeHandler(Builder b) {
4444
* {@inheritDoc}
4545
*/
4646
@Override
47-
public final void onThrowable(Throwable t) {
47+
public void onThrowable(Throwable t) {
4848
onFailure(t);
4949
}
5050

5151
/**
5252
* {@inheritDoc}
5353
*/
5454
@Override
55-
public final STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
55+
public STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
5656
return STATE.CONTINUE;
5757
}
5858

5959
/**
6060
* {@inheritDoc}
6161
*/
6262
@Override
63-
public final STATE onStatusReceived(HttpResponseStatus responseStatus) throws Exception {
63+
public STATE onStatusReceived(HttpResponseStatus responseStatus) throws Exception {
6464
if (responseStatus.getStatusCode() == 101) {
6565
return STATE.UPGRADE;
6666
} else {
@@ -72,15 +72,15 @@ public final STATE onStatusReceived(HttpResponseStatus responseStatus) throws Ex
7272
* {@inheritDoc}
7373
*/
7474
@Override
75-
public final STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception {
75+
public STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception {
7676
return STATE.CONTINUE;
7777
}
7878

7979
/**
8080
* {@inheritDoc}
8181
*/
8282
@Override
83-
public final WebSocket onCompleted() throws Exception {
83+
public WebSocket onCompleted() throws Exception {
8484
if (webSocket == null) {
8585
throw new IllegalStateException("WebSocket is null");
8686
}
@@ -91,7 +91,7 @@ public final WebSocket onCompleted() throws Exception {
9191
* {@inheritDoc}
9292
*/
9393
@Override
94-
public final void onSuccess(WebSocket webSocket) {
94+
public void onSuccess(WebSocket webSocket) {
9595
this.webSocket = webSocket;
9696
for (WebSocketListener w : l) {
9797
webSocket.addWebSocketListener(w);
@@ -104,7 +104,7 @@ public final void onSuccess(WebSocket webSocket) {
104104
* {@inheritDoc}
105105
*/
106106
@Override
107-
public final void onFailure(Throwable t) {
107+
public void onFailure(Throwable t) {
108108
for (WebSocketListener w : l) {
109109
if (!ok.get() && webSocket != null) {
110110
webSocket.addWebSocketListener(w);
@@ -113,7 +113,7 @@ public final void onFailure(Throwable t) {
113113
}
114114
}
115115

116-
public final void onClose(WebSocket webSocket, int status, String reasonPhrase) {
116+
public void onClose(WebSocket webSocket, int status, String reasonPhrase) {
117117
// Connect failure
118118
if (this.webSocket == null) this.webSocket = webSocket;
119119

0 commit comments

Comments
 (0)