Fixes #4248 - WebSocketClient UpgradeResponse.isSuccess never set true
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
4825832a53
commit
544ad0a28a
|
@ -55,6 +55,13 @@ public class ClientUpgradeResponse extends UpgradeResponseAdapter
|
|||
setAcceptedSubProtocol(fields.get(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccess()
|
||||
{
|
||||
// If we reached this point, where we have a UpgradeResponse object, then the upgrade is a success.
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExtensionConfig> getExtensions()
|
||||
{
|
||||
|
|
|
@ -596,9 +596,11 @@ public class WebSocketUpgradeRequest extends HttpRequest implements CompleteList
|
|||
|
||||
URI requestURI = this.getURI();
|
||||
|
||||
ClientUpgradeResponse upgradeResponse = new ClientUpgradeResponse(response);
|
||||
|
||||
WebSocketSession session = getSessionFactory().createSession(requestURI, localEndpoint, connection);
|
||||
session.setUpgradeRequest(new ClientUpgradeRequest(this));
|
||||
session.setUpgradeResponse(new ClientUpgradeResponse(response));
|
||||
session.setUpgradeResponse(upgradeResponse);
|
||||
connection.addListener(session);
|
||||
|
||||
List<ExtensionConfig> extensions = new ArrayList<>();
|
||||
|
@ -637,7 +639,7 @@ public class WebSocketUpgradeRequest extends HttpRequest implements CompleteList
|
|||
|
||||
if (upgradeListener != null)
|
||||
{
|
||||
upgradeListener.onHandshakeResponse(new ClientUpgradeResponse(response));
|
||||
upgradeListener.onHandshakeResponse(upgradeResponse);
|
||||
}
|
||||
|
||||
// Now swap out the connection
|
||||
|
|
|
@ -196,7 +196,8 @@ public class CookieTest
|
|||
serverConn.write(serverCookieFrame);
|
||||
|
||||
// Confirm client connect on future
|
||||
clientConnectFuture.get(10, TimeUnit.SECONDS);
|
||||
Session session = clientConnectFuture.get(10, TimeUnit.SECONDS);
|
||||
assertTrue(session.getUpgradeResponse().isSuccess(), "UpgradeResponse.isSuccess()");
|
||||
clientSocket.awaitOpen(2, TimeUnit.SECONDS);
|
||||
|
||||
// Wait for client receipt of cookie frame via client websocket
|
||||
|
|
Loading…
Reference in New Issue