public static Socks4CommandStatus valueOf(byte b) { switch (b) { case 0x5a: return SUCCESS; case 0x5b: return REJECTED_OR_FAILED; case 0x5c: return IDENTD_UNREACHABLE; case 0x5d: return IDENTD_AUTH_FAILURE; } return new Socks4CommandStatus(b); }
@Override protected void encode(ChannelHandlerContext ctx, Socks4CommandResponse msg, ByteBuf out) throws Exception { out.writeByte(0); out.writeByte(msg.status().byteValue()); out.writeShort(msg.dstPort()); out.writeBytes(msg.dstAddr() == null? IPv4_HOSTNAME_ZEROED : NetUtil.createByteArrayFromIpAddressString(msg.dstAddr())); } }
final Socks4CommandStatus status = Socks4CommandStatus.valueOf(in.readByte()); final int dstPort = in.readUnsignedShort(); final String dstAddr = NetUtil.intToIpAddress(in.readInt());
final Socks4CommandStatus status = Socks4CommandStatus.valueOf(in.readByte()); final int dstPort = in.readUnsignedShort(); final String dstAddr = NetUtil.intToIpAddress(in.readInt());
@Override protected void encode(ChannelHandlerContext ctx, Socks4CommandResponse msg, ByteBuf out) throws Exception { out.writeByte(0); out.writeByte(msg.status().byteValue()); out.writeShort(msg.dstPort()); out.writeBytes(msg.dstAddr() == null? IPv4_HOSTNAME_ZEROED : NetUtil.createByteArrayFromIpAddressString(msg.dstAddr())); } }
public static Socks4CommandStatus valueOf(byte b) { switch (b) { case 0x5a: return SUCCESS; case 0x5b: return REJECTED_OR_FAILED; case 0x5c: return IDENTD_UNREACHABLE; case 0x5d: return IDENTD_AUTH_FAILURE; } return new Socks4CommandStatus(b); }
final Socks4CommandStatus status = Socks4CommandStatus.valueOf(in.readByte()); final int dstPort = in.readUnsignedShort(); final String dstAddr = NetUtil.intToIpAddress(in.readInt());
@Override protected void encode(ChannelHandlerContext ctx, Socks4CommandResponse msg, ByteBuf out) throws Exception { out.writeByte(0); out.writeByte(msg.status().byteValue()); out.writeShort(msg.dstPort()); out.writeBytes(msg.dstAddr() == null? IPv4_HOSTNAME_ZEROED : NetUtil.createByteArrayFromIpAddressString(msg.dstAddr())); } }
public static Socks4CommandStatus valueOf(byte b) { switch (b) { case 0x5a: return SUCCESS; case 0x5b: return REJECTED_OR_FAILED; case 0x5c: return IDENTD_UNREACHABLE; case 0x5d: return IDENTD_AUTH_FAILURE; } return new Socks4CommandStatus(b); }