diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAddressType.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAddressType.java index 5eb157befd..856f3e714c 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAddressType.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAddressType.java @@ -28,7 +28,15 @@ public enum SocksAddressType { this.b = b; } + /** + * @deprecated Use {@link #valueOf(byte)} instead. + */ + @Deprecated public static SocksAddressType fromByte(byte b) { + return valueOf(b); + } + + public static SocksAddressType valueOf(byte b) { for (SocksAddressType code : values()) { if (code.b == b) { return code; diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java index 53394e052b..6678529856 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java @@ -42,7 +42,7 @@ public class SocksAuthRequestDecoder extends ReplayingDecoder out) throws Exception { switch (state()) { case CHECK_PROTOCOL_VERSION: { - version = SocksSubnegotiationVersion.fromByte(byteBuf.readByte()); + version = SocksSubnegotiationVersion.valueOf(byteBuf.readByte()); if (version != SocksSubnegotiationVersion.AUTH_PASSWORD) { break; } diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthResponseDecoder.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthResponseDecoder.java index 7e42955d79..5674a10c7a 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthResponseDecoder.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthResponseDecoder.java @@ -40,14 +40,14 @@ public class SocksAuthResponseDecoder extends ReplayingDecoder out) throws Exception { switch (state()) { case CHECK_PROTOCOL_VERSION: { - version = SocksProtocolVersion.fromByte(byteBuf.readByte()); + version = SocksProtocolVersion.valueOf(byteBuf.readByte()); if (version != SocksProtocolVersion.SOCKS5) { break; } checkpoint(State.READ_CMD_HEADER); } case READ_CMD_HEADER: { - cmdStatus = SocksCmdStatus.fromByte(byteBuf.readByte()); + cmdStatus = SocksCmdStatus.valueOf(byteBuf.readByte()); reserved = byteBuf.readByte(); - addressType = SocksAddressType.fromByte(byteBuf.readByte()); + addressType = SocksAddressType.valueOf(byteBuf.readByte()); checkpoint(State.READ_CMD_ADDRESS); } case READ_CMD_ADDRESS: { diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdStatus.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdStatus.java index 40c7b9d346..51886e45d7 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdStatus.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdStatus.java @@ -34,7 +34,15 @@ public enum SocksCmdStatus { this.b = b; } + /** + * @deprecated Use {@link #valueOf(byte)} instead. + */ + @Deprecated public static SocksCmdStatus fromByte(byte b) { + return valueOf(b); + } + + public static SocksCmdStatus valueOf(byte b) { for (SocksCmdStatus code : values()) { if (code.b == b) { return code; diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdType.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdType.java index b236b7712c..39d3f5f7ad 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdType.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdType.java @@ -28,7 +28,15 @@ public enum SocksCmdType { this.b = b; } + /** + * @deprecated Use {@link #valueOf(byte)} instead. + */ + @Deprecated public static SocksCmdType fromByte(byte b) { + return valueOf(b); + } + + public static SocksCmdType valueOf(byte b) { for (SocksCmdType code : values()) { if (code.b == b) { return code; diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java index 0121d2a0ae..5a17c00f8a 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java @@ -41,7 +41,7 @@ public class SocksInitRequestDecoder extends ReplayingDecoder out) throws Exception { switch (state()) { case CHECK_PROTOCOL_VERSION: { - version = SocksProtocolVersion.fromByte(byteBuf.readByte()); + version = SocksProtocolVersion.valueOf(byteBuf.readByte()); if (version != SocksProtocolVersion.SOCKS5) { break; } @@ -51,7 +51,7 @@ public class SocksInitRequestDecoder extends ReplayingDecoder out) throws Exception { switch (state()) { case CHECK_PROTOCOL_VERSION: { - version = SocksProtocolVersion.fromByte(byteBuf.readByte()); + version = SocksProtocolVersion.valueOf(byteBuf.readByte()); if (version != SocksProtocolVersion.SOCKS5) { break; } checkpoint(State.READ_PREFFERED_AUTH_TYPE); } case READ_PREFFERED_AUTH_TYPE: { - authScheme = SocksAuthScheme.fromByte(byteBuf.readByte()); + authScheme = SocksAuthScheme.valueOf(byteBuf.readByte()); msg = new SocksInitResponse(authScheme); break; } diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksProtocolVersion.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksProtocolVersion.java index f5a2428702..67bbfd15f1 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksProtocolVersion.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksProtocolVersion.java @@ -27,7 +27,15 @@ public enum SocksProtocolVersion { this.b = b; } + /** + * @deprecated Use {@link #valueOf(byte)} instead. + */ + @Deprecated public static SocksProtocolVersion fromByte(byte b) { + return valueOf(b); + } + + public static SocksProtocolVersion valueOf(byte b) { for (SocksProtocolVersion code : values()) { if (code.b == b) { return code; diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksSubnegotiationVersion.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksSubnegotiationVersion.java index f3846903ff..90e7b89041 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksSubnegotiationVersion.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksSubnegotiationVersion.java @@ -26,7 +26,15 @@ public enum SocksSubnegotiationVersion { this.b = b; } + /** + * @deprecated Use {@link #valueOf(byte)} instead. + */ + @Deprecated public static SocksSubnegotiationVersion fromByte(byte b) { + return valueOf(b); + } + + public static SocksSubnegotiationVersion valueOf(byte b) { for (SocksSubnegotiationVersion code : values()) { if (code.b == b) { return code;