private void encodeCommandResponse(Socks5CommandResponse msg, ByteBuf out) throws Exception { out.writeByte(msg.version().byteValue()); out.writeByte(msg.status().byteValue()); out.writeByte(0x00); final Socks5AddressType bndAddrType = msg.bndAddrType(); out.writeByte(bndAddrType.byteValue()); addressEncoder.encodeAddress(bndAddrType, msg.bndAddr(), out); out.writeShort(msg.bndPort()); } }
@Override void read(ConnectionFlow flow, Object msg) { removeHandlerIfPresent(SOCKS_ENCODER_NAME); removeHandlerIfPresent(SOCKS_DECODER_NAME); if (msg instanceof Socks5CommandResponse) { if (((Socks5CommandResponse) msg).status() == Socks5CommandStatus.SUCCESS) { flow.advance(); return; } } flow.fail(); }
private void encodeCommandResponse(Socks5CommandResponse msg, ByteBuf out) throws Exception { out.writeByte(msg.version().byteValue()); out.writeByte(msg.status().byteValue()); out.writeByte(0x00); final Socks5AddressType bndAddrType = msg.bndAddrType(); out.writeByte(bndAddrType.byteValue()); addressEncoder.encodeAddress(bndAddrType, msg.bndAddr(), out); out.writeShort(msg.bndPort()); } }
private void encodeCommandResponse(Socks5CommandResponse msg, ByteBuf out) throws Exception { out.writeByte(msg.version().byteValue()); out.writeByte(msg.status().byteValue()); out.writeByte(0x00); final Socks5AddressType bndAddrType = msg.bndAddrType(); out.writeByte(bndAddrType.byteValue()); addressEncoder.encodeAddress(bndAddrType, msg.bndAddr(), out); out.writeShort(msg.bndPort()); } }