forked from wso2/transport-http
-
Notifications
You must be signed in to change notification settings - Fork 0
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 wso2#166 from riyafa/cancel
Get response from server on client handshake
- Loading branch information
Showing
27 changed files
with
485 additions
and
336 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...src/main/java/org/wso2/transport/http/netty/contract/websocket/ClientHandshakeFuture.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,53 @@ | ||
/* | ||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. licenses this file to you 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 org.wso2.transport.http.netty.contract.websocket; | ||
|
||
import org.wso2.transport.http.netty.message.HttpCarbonResponse; | ||
|
||
/** | ||
* Future for WebSocket handshake. | ||
*/ | ||
public interface ClientHandshakeFuture { | ||
|
||
/** | ||
* Set the listener for WebSocket handshake. | ||
* | ||
* @param serverHandshakeListener Listener for WebSocket handshake. | ||
* @return the same handshake future. | ||
*/ | ||
ClientHandshakeFuture setClientHandshakeListener(ClientHandshakeListener serverHandshakeListener); | ||
|
||
/** | ||
* Notify the success of the WebSocket handshake. | ||
* | ||
* @param webSocketConnection {@link WebSocketConnection} for the successful connection. | ||
* @param response {@link HttpCarbonResponse} received from server. | ||
*/ | ||
void notifySuccess(WebSocketConnection webSocketConnection, HttpCarbonResponse response); | ||
|
||
/** | ||
* Notify any error occurred during the handshake. | ||
* | ||
* @param throwable error occurred during handshake. | ||
* @param response {@link HttpCarbonResponse} received from server or null if error occurred before response is | ||
* received. | ||
*/ | ||
void notifyError(Throwable throwable, HttpCarbonResponse response); | ||
} |
42 changes: 42 additions & 0 deletions
42
...c/main/java/org/wso2/transport/http/netty/contract/websocket/ClientHandshakeListener.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,42 @@ | ||
/* | ||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. licenses this file to you 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 org.wso2.transport.http.netty.contract.websocket; | ||
|
||
import org.wso2.transport.http.netty.message.HttpCarbonResponse; | ||
|
||
/** | ||
* Future listener for WebSocket handshake. | ||
*/ | ||
public interface ClientHandshakeListener { | ||
|
||
/** | ||
* Notify the success of the handshake. | ||
* | ||
* @param webSocketConnection {@link WebSocketConnection} for the successful handshake. | ||
*/ | ||
void onSuccess(WebSocketConnection webSocketConnection, HttpCarbonResponse response); | ||
|
||
/** | ||
* Notify error on handshake. | ||
* @param t error occurred during handshake. | ||
*/ | ||
void onError(Throwable t, HttpCarbonResponse response); | ||
|
||
} |
29 changes: 0 additions & 29 deletions
29
...netty/src/main/java/org/wso2/transport/http/netty/contract/websocket/HandshakeFuture.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
...src/main/java/org/wso2/transport/http/netty/contract/websocket/ServerHandshakeFuture.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,48 @@ | ||
/* | ||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. licenses this file to you 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 org.wso2.transport.http.netty.contract.websocket; | ||
|
||
/** | ||
* Future for WebSocket handshake. | ||
*/ | ||
public interface ServerHandshakeFuture { | ||
|
||
/** | ||
* Set the listener for WebSocket handshake. | ||
* | ||
* @param serverHandshakeListener Listener for WebSocket handshake. | ||
* @return the same handshake future. | ||
*/ | ||
ServerHandshakeFuture setHandshakeListener(ServerHandshakeListener serverHandshakeListener); | ||
|
||
/** | ||
* Notify the success of the WebSocket handshake. | ||
* | ||
* @param webSocketConnection {@link WebSocketConnection} for the successful connection. | ||
*/ | ||
void notifySuccess(WebSocketConnection webSocketConnection); | ||
|
||
/** | ||
* Notify any error occurred during the handshake. | ||
* | ||
* @param throwable error occurred during handshake. | ||
*/ | ||
void notifyError(Throwable throwable); | ||
} |
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
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
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
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
Oops, something went wrong.