@Override protected Object newInitialMessage(ChannelHandlerContext ctx) throws Exception { InetSocketAddress raddr = destinationAddress(); String rhost; if (raddr.isUnresolved()) { rhost = raddr.getHostString(); } else { rhost = raddr.getAddress().getHostAddress(); } return new DefaultSocks4CommandRequest( Socks4CommandType.CONNECT, rhost, raddr.getPort(), username != null? username : ""); }
private void fail(List<Object> out, Exception cause) { if (!(cause instanceof DecoderException)) { cause = new DecoderException(cause); } Socks4CommandRequest m = new DefaultSocks4CommandRequest( type != null? type : Socks4CommandType.CONNECT, dstAddr != null? dstAddr : "", dstPort != 0? dstPort : 65535, userId != null? userId : ""); m.setDecoderResult(DecoderResult.failure(cause)); out.add(m); checkpoint(State.FAILURE); }
dstAddr = readString("dstAddr", in); out.add(new DefaultSocks4CommandRequest(type, dstAddr, dstPort, userId)); checkpoint(State.SUCCESS);
@Override protected Object newInitialMessage(ChannelHandlerContext ctx) throws Exception { InetSocketAddress raddr = destinationAddress(); String rhost; if (raddr.isUnresolved()) { rhost = raddr.getHostString(); } else { rhost = raddr.getAddress().getHostAddress(); } return new DefaultSocks4CommandRequest( Socks4CommandType.CONNECT, rhost, raddr.getPort(), username != null? username : ""); }
@Override protected Object newInitialMessage(ChannelHandlerContext ctx) throws Exception { InetSocketAddress raddr = destinationAddress(); String rhost; if (raddr.isUnresolved()) { rhost = raddr.getHostString(); } else { rhost = raddr.getAddress().getHostAddress(); } return new DefaultSocks4CommandRequest( Socks4CommandType.CONNECT, rhost, raddr.getPort(), username != null? username : ""); }
@Override protected Future<?> execute() { InetSocketAddress destinationAddress; try { destinationAddress = addressFor(serverHostAndPort, proxyServer); } catch (UnknownHostException e) { return channel.newFailedFuture(e); } DefaultSocks4CommandRequest connectRequest = new DefaultSocks4CommandRequest( Socks4CommandType.CONNECT, destinationAddress.getHostString(), destinationAddress.getPort()); addFirstOrReplaceHandler(SOCKS_ENCODER_NAME, Socks4ClientEncoder.INSTANCE); addFirstOrReplaceHandler(SOCKS_DECODER_NAME, new Socks4ClientDecoder()); return writeToChannel(connectRequest); }
private void fail(List<Object> out, Exception cause) { if (!(cause instanceof DecoderException)) { cause = new DecoderException(cause); } Socks4CommandRequest m = new DefaultSocks4CommandRequest( type != null? type : Socks4CommandType.CONNECT, dstAddr != null? dstAddr : "", dstPort != 0? dstPort : 65535, userId != null? userId : ""); m.setDecoderResult(DecoderResult.failure(cause)); out.add(m); checkpoint(State.FAILURE); }
private void fail(List<Object> out, Exception cause) { if (!(cause instanceof DecoderException)) { cause = new DecoderException(cause); } Socks4CommandRequest m = new DefaultSocks4CommandRequest( type != null? type : Socks4CommandType.CONNECT, dstAddr != null? dstAddr : "", dstPort != 0? dstPort : 65535, userId != null? userId : ""); m.setDecoderResult(DecoderResult.failure(cause)); out.add(m); checkpoint(State.FAILURE); }
dstAddr = readString("dstAddr", in); out.add(new DefaultSocks4CommandRequest(type, dstAddr, dstPort, userId)); checkpoint(State.SUCCESS);
dstAddr = readString("dstAddr", in); out.add(new DefaultSocks4CommandRequest(type, dstAddr, dstPort, userId)); checkpoint(State.SUCCESS);