@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 public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", type: "); } else { buf.append("(type: "); } buf.append(type()); buf.append(", dstAddr: "); buf.append(dstAddr()); buf.append(", dstPort: "); buf.append(dstPort()); buf.append(", userId: "); buf.append(userId()); buf.append(')'); return buf.toString(); } }
@Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", type: "); } else { buf.append("(type: "); } buf.append(type()); buf.append(", dstAddr: "); buf.append(dstAddr()); buf.append(", dstPort: "); buf.append(dstPort()); buf.append(", userId: "); buf.append(userId()); buf.append(')'); return buf.toString(); } }
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); }
@Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", type: "); } else { buf.append("(type: "); } buf.append(type()); buf.append(", dstAddr: "); buf.append(dstAddr()); buf.append(", dstPort: "); buf.append(dstPort()); buf.append(", userId: "); buf.append(userId()); buf.append(')'); return buf.toString(); } }
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);