Codota Logo
SocksMethod
Code IndexAdd Codota to your IDE (free)

How to use
SocksMethod
in
sockslib.common.methods

Best Java code snippets using sockslib.common.methods.SocksMethod (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: theotherp/nzbhydra2

/**
 * Constructs an instance of {@link MethodSelectionResponseMessage} with a version and a method.
 *
 * @param version     Version.
 * @param socksMethod Selected method.
 */
public MethodSelectionResponseMessage(int version, SocksMethod socksMethod) {
  this(version, socksMethod.getByte());
}
origin: theotherp/nzbhydra2

/**
 * Puts a {@link SocksMethod} class into the SOCKS method registry with an instance of
 * {@link SocksMethod}.
 *
 * @param socksMethod The instance of {@link SocksMethod}.
 */
public static void putMethod(SocksMethod socksMethod) {
  checkNotNull(socksMethod, "Argument [socksMethod] may not be null");
  logger.debug("Register {}[{}]", socksMethod.getMethodName(), socksMethod.getByte());
  methods.put((byte) socksMethod.getByte(), socksMethod);
}
origin: theotherp/nzbhydra2

logger.debug("SESSION[{}] Response client:{}", session.getId(), selectedMethod.getMethodName());
selectedMethod.doMethod(session);
origin: theotherp/nzbhydra2

@Override
public void buildConnection() throws SocksException, IOException {
  if (inetAddress == null) {
    throw new IllegalArgumentException("Please set inetAddress before calling buildConnection.");
  }
  if (proxySocket == null) {
    proxySocket = createProxySocket(inetAddress, port);
  } else if (!proxySocket.isConnected()) {
    proxySocket.connect(new InetSocketAddress(inetAddress, port));
  }
  SocksMethod method =
      socksMethodRequester.doRequest(acceptableMethods, proxySocket, SOCKS_VERSION);
  method.doMethod(this);
}
origin: fengyouchao/sockslib

logger.debug("SESSION[{}] Response client:{}", session.getId(), selectedMethod.getMethodName());
selectedMethod.doMethod(session);
origin: fengyouchao/sockslib

@Override
public void buildConnection() throws SocksException, IOException {
 if (inetAddress == null) {
  throw new IllegalArgumentException("Please set inetAddress before calling buildConnection.");
 }
 if (proxySocket == null) {
  proxySocket = createProxySocket(inetAddress, port);
 } else if (!proxySocket.isConnected()) {
  proxySocket.connect(new InetSocketAddress(inetAddress, port));
 }
 SocksMethod method =
   socksMethodRequester.doRequest(acceptableMethods, proxySocket, SOCKS_VERSION);
 method.doMethod(this);
}
origin: fengyouchao/sockslib

/**
 * Constructs an instance of {@link MethodSelectionResponseMessage} with a version and a method.
 *
 * @param version     Version.
 * @param socksMethod Selected method.
 */
public MethodSelectionResponseMessage(int version, SocksMethod socksMethod) {
 this(version, socksMethod.getByte());
}
origin: fengyouchao/sockslib

/**
 * Puts a {@link SocksMethod} class into the SOCKS method registry with an instance of
 * {@link SocksMethod}.
 *
 * @param socksMethod The instance of {@link SocksMethod}.
 */
public static void putMethod(SocksMethod socksMethod) {
 checkNotNull(socksMethod, "Argument [socksMethod] may not be null");
 logger.debug("Register {}[{}]", socksMethod.getMethodName(), socksMethod.getByte());
 methods.put((byte) socksMethod.getByte(), socksMethod);
}
origin: theotherp/nzbhydra2

/**
 * Constructs an instance of {@link MethodSelectionResponseMessage} with a method.
 *
 * @param socksMethod Selected method.
 */
public MethodSelectionResponseMessage(SocksMethod socksMethod) {
  this(5, socksMethod.getByte());
}
origin: fengyouchao/sockslib

/**
 * Constructs an instance of {@link MethodSelectionResponseMessage} with a method.
 *
 * @param socksMethod Selected method.
 */
public MethodSelectionResponseMessage(SocksMethod socksMethod) {
 this(5, socksMethod.getByte());
}
origin: theotherp/nzbhydra2

@Override
public boolean equals(Object obj) {
  return obj instanceof SocksMethod && ((SocksMethod) obj).getByte() == this.getByte();
}
origin: fengyouchao/sockslib

@Override
public boolean equals(Object obj) {
 return obj instanceof SocksMethod && ((SocksMethod) obj).getByte() == this.getByte();
}
origin: theotherp/nzbhydra2

@Override
public SocksMethod select(MethodSelectionMessage message) {
  int[] methods = message.getMethods();
  for (int i = 0; i < methods.length; i++) {
    for (SocksMethod method : supportMethods) {
      if (method.getByte() == methods[i]) {
        return method;
      }
    }
  }
  return new NoAcceptableMethod();
}
origin: fengyouchao/sockslib

@Override
public SocksMethod select(MethodSelectionMessage message) {
 int[] methods = message.getMethods();
 for (int i = 0; i < methods.length; i++) {
  for (SocksMethod method : supportMethods) {
   if (method.getByte() == methods[i]) {
    return method;
   }
  }
 }
 return new NoAcceptableMethod();
}
origin: theotherp/nzbhydra2

@Override
public SocksMethod doRequest(List<SocksMethod> acceptableMethods, Socket socket, int
    socksVersion) throws SocksException, IOException {
  InputStream inputStream = socket.getInputStream();
  OutputStream outputStream = socket.getOutputStream();
  byte[] bufferSent = new byte[2 + acceptableMethods.size()];
  bufferSent[0] = (byte) socksVersion;
  bufferSent[1] = (byte) acceptableMethods.size();
  for (int i = 0; i < acceptableMethods.size(); i++) {
    bufferSent[2 + i] = (byte) acceptableMethods.get(i).getByte();
  }
  outputStream.write(bufferSent);
  outputStream.flush();
  logger.debug("{}", LogMessageBuilder.build(bufferSent, MsgType.SEND));
  // Received data.
  byte[] receivedData = StreamUtil.read(inputStream, 2);
  logger.debug("{}", LogMessageBuilder.build(receivedData, MsgType.RECEIVE));
  if (receivedData[0] != socksVersion) {
    throw new SocksException("Remote server don't support SOCKS5");
  }
  return SocksMethodRegistry.getByByte(receivedData[1]);
}
origin: fengyouchao/sockslib

@Override
public SocksMethod doRequest(List<SocksMethod> acceptableMethods, Socket socket, int
  socksVersion) throws SocksException, IOException {
 InputStream inputStream = socket.getInputStream();
 OutputStream outputStream = socket.getOutputStream();
 byte[] bufferSent = new byte[2 + acceptableMethods.size()];
 bufferSent[0] = (byte) socksVersion;
 bufferSent[1] = (byte) acceptableMethods.size();
 for (int i = 0; i < acceptableMethods.size(); i++) {
  bufferSent[2 + i] = (byte) acceptableMethods.get(i).getByte();
 }
 outputStream.write(bufferSent);
 outputStream.flush();
 logger.debug("{}", LogMessageBuilder.build(bufferSent, MsgType.SEND));
 // Received data.
 byte[] receivedData = StreamUtil.read(inputStream, 2);
 logger.debug("{}", LogMessageBuilder.build(receivedData, MsgType.RECEIVE));
 if (receivedData[0] != socksVersion) {
  throw new SocksException("Remote server don't support SOCKS5");
 }
 return SocksMethodRegistry.getByByte(receivedData[1]);
}
sockslib.common.methodsSocksMethod

Javadoc

The interface SocksMethod define a socks method in SOCKS4 or SOCKS5 protocol.

SOCKS5 protocol in RFC 1928:
The values currently defined for METHOD are:
  • X’00’ NO AUTHENTICATION REQUIRED
  • X’01’ GSSAPI
  • X’02’ USERNAME/PASSWORD
  • X’03’ to X’7F’ IANA ASSIGNED
  • X’80’ to X’FE’ RESERVED FOR PRIVATE METHODS
  • X’FF’ NO ACCEPTABLE METHODS

Most used methods

  • doMethod
    Do method job. This method will be called by SOCKS server.
  • getByte
    method byte.
  • getMethodName
    Gets method's name.

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • startActivity (Activity)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now