Search in sources :

Example 1 with CommandNotSupportedException

use of com.github.jh3nd3rs0n.jargyle.transport.socks5.CommandNotSupportedException in project jargyle by jh3nd3rs0n.

the class Socks5Worker method newSocks5Request.

private Socks5Request newSocks5Request() {
    Socks5Request socks5Request = null;
    try {
        socks5Request = Socks5Request.newInstanceFrom(this.clientFacingInputStream);
    } catch (AddressTypeNotSupportedException e) {
        LOGGER.debug(ObjectLogMessageHelper.objectLogMessage(this, "Unable to parse the SOCKS5 request"), e);
        Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.ADDRESS_TYPE_NOT_SUPPORTED);
        this.socks5WorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
        return null;
    } catch (CommandNotSupportedException e) {
        LOGGER.debug(ObjectLogMessageHelper.objectLogMessage(this, "Unable to parse the SOCKS5 request"), e);
        Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.COMMAND_NOT_SUPPORTED);
        this.socks5WorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
        return null;
    } catch (IOException e) {
        ClientFacingIOExceptionLoggingHelper.log(LOGGER, ObjectLogMessageHelper.objectLogMessage(this, "Error in parsing the SOCKS5 request"), e);
        return null;
    }
    LOGGER.debug(ObjectLogMessageHelper.objectLogMessage(this, "Received %s", socks5Request.toString()));
    return socks5Request;
}
Also used : Socks5Request(com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Request) Socks5Reply(com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply) CommandNotSupportedException(com.github.jh3nd3rs0n.jargyle.transport.socks5.CommandNotSupportedException) IOException(java.io.IOException) AddressTypeNotSupportedException(com.github.jh3nd3rs0n.jargyle.transport.socks5.AddressTypeNotSupportedException)

Aggregations

AddressTypeNotSupportedException (com.github.jh3nd3rs0n.jargyle.transport.socks5.AddressTypeNotSupportedException)1 CommandNotSupportedException (com.github.jh3nd3rs0n.jargyle.transport.socks5.CommandNotSupportedException)1 Socks5Reply (com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply)1 Socks5Request (com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Request)1 IOException (java.io.IOException)1