Tabnine Logo
SocksMethod.getByte
Code IndexAdd Tabnine to your IDE (free)

How to use
getByte
method
in
sockslib.common.methods.SocksMethod

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

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: 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

/**
 * Constructs an instance of {@link MethodSelectionResponseMessage} with a method.
 *
 * @param socksMethod Selected method.
 */
public MethodSelectionResponseMessage(SocksMethod socksMethod) {
 this(5, socksMethod.getByte());
}
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

/**
 * 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

/**
 * 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: fengyouchao/sockslib

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

@Override
public boolean equals(Object obj) {
  return obj instanceof SocksMethod && ((SocksMethod) obj).getByte() == this.getByte();
}
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 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.methodsSocksMethodgetByte

Javadoc

method byte.

Popular methods of SocksMethod

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

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JCheckBox (javax.swing)
  • JFileChooser (javax.swing)
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now