diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java index 7a4bcb463c..452ba1a13c 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java @@ -214,13 +214,13 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker { } String upgrade = response.getHeader(Names.UPGRADE); - if (upgrade == null || !upgrade.equalsIgnoreCase(Values.WEBSOCKET)) { + if (Values.WEBSOCKET.equalsIgnoreCase(upgrade)) { throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); } String connection = response.getHeader(Names.CONNECTION); - if (connection == null || !connection.equalsIgnoreCase(Values.UPGRADE)) { + if (Values.UPGRADE.equalsIgnoreCase(connection)) { throw new WebSocketHandshakeException("Invalid handshake response connection: " + response.getHeader(Names.CONNECTION)); } diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java index 3c73062e2c..56c2f2c111 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java @@ -190,13 +190,13 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker { } String upgrade = response.getHeader(Names.UPGRADE); - if (upgrade == null || !upgrade.equalsIgnoreCase(Values.WEBSOCKET)) { + if (Values.WEBSOCKET.equalsIgnoreCase(upgrade)) { throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); } String connection = response.getHeader(Names.CONNECTION); - if (connection == null || !connection.equalsIgnoreCase(Values.UPGRADE)) { + if (Values.UPGRADE.equalsIgnoreCase(connection)) { throw new WebSocketHandshakeException("Invalid handshake response connection: " + response.getHeader(Names.CONNECTION)); } diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java index a80c5cb70b..159c8cb96c 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java @@ -190,13 +190,13 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker { } String upgrade = response.getHeader(Names.UPGRADE); - if (upgrade == null || !upgrade.equalsIgnoreCase(Values.WEBSOCKET)) { + if (Values.WEBSOCKET.equalsIgnoreCase(upgrade)) { throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); } String connection = response.getHeader(Names.CONNECTION); - if (connection == null || !connection.equalsIgnoreCase(Values.UPGRADE)) { + if (Values.UPGRADE.equalsIgnoreCase(connection)) { throw new WebSocketHandshakeException("Invalid handshake response connection: " + response.getHeader(Names.CONNECTION)); }