Class SocksCmdResponse
java.lang.Object
io.netty.handler.codec.socks.SocksMessage
io.netty.handler.codec.socks.SocksResponse
io.netty.handler.codec.socks.SocksCmdResponse
-
Constructor Summary
ConstructorsConstructorDescriptionSocksCmdResponse(SocksCmdStatus cmdStatus, SocksAddressType addressType) SocksCmdResponse(SocksCmdStatus cmdStatus, SocksAddressType addressType, String host, int port) Constructs new response and includes provided host and port as part of it. -
Method Summary
Modifier and TypeMethodDescriptionReturns theSocksAddressTypeof thisSocksCmdResponseReturns theSocksCmdStatusof thisSocksCmdResponsevoidencodeAsByteBuf(ByteBuf byteBuf) host()Returns host that is used as a parameter inSocksCmdType.intport()Returns port that is used as a parameter inSocksCmdType.Methods inherited from class SocksResponse
responseTypeMethods inherited from class SocksMessage
protocolVersion, type
-
Constructor Details
-
SocksCmdResponse
-
SocksCmdResponse
public SocksCmdResponse(SocksCmdStatus cmdStatus, SocksAddressType addressType, String host, int port) Constructs new response and includes provided host and port as part of it.- Parameters:
cmdStatus- status of the responseaddressType- type of host parameterhost- host (BND.ADDR field) is address that server used when connecting to the target host. When null a value of 4/8 0x00 octets will be used for IPv4/IPv6 and a single 0x00 byte will be used for domain addressType. Value is converted to ASCII usingIDN.toASCII(String).port- port (BND.PORT field) that the server assigned to connect to the target host- Throws:
NullPointerException- in case cmdStatus or addressType are missingIllegalArgumentException- in case host or port cannot be validated- See Also:
-
-
Method Details
-
cmdStatus
Returns theSocksCmdStatusof thisSocksCmdResponse- Returns:
- The
SocksCmdStatusof thisSocksCmdResponse
-
addressType
Returns theSocksAddressTypeof thisSocksCmdResponse- Returns:
- The
SocksAddressTypeof thisSocksCmdResponse
-
host
Returns host that is used as a parameter inSocksCmdType. Host (BND.ADDR field in response) is address that server used when connecting to the target host. This is typically different from address which client uses to connect to the SOCKS server.- Returns:
- host that is used as a parameter in
SocksCmdTypeor null when there was no host specified during response construction
-
port
public int port()Returns port that is used as a parameter inSocksCmdType. Port (BND.PORT field in response) is port that the server assigned to connect to the target host.- Returns:
- port that is used as a parameter in
SocksCmdType
-
encodeAsByteBuf
- Specified by:
encodeAsByteBufin classSocksMessage
-