Codota Logo
Session.write
Code IndexAdd Codota to your IDE (free)

How to use
write
method
in
sockslib.server.Session

Best Java code snippets using sockslib.server.Session.write (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: theotherp/nzbhydra2

@Override
public void doMethod(Session session) throws SocksException, IOException {
  checkNotNull(session, "Argument [session] may not be null");
  checkNotNull(authenticator, "Please set an authenticator");
  UsernamePasswordMessage usernamePasswordMessage = new UsernamePasswordMessage();
  session.read(usernamePasswordMessage);
  logger.debug("SESSION[{}] Receive credentials: {}", session.getId(), usernamePasswordMessage
      .getUsernamePasswordCredentials());
  try {
    authenticator.doAuthenticate(usernamePasswordMessage.getUsernamePasswordCredentials(),
        session);
  } catch (AuthenticationException e) {
    session.write(new UsernamePasswordResponseMessage(false));
    throw e;
  }
  session.write(new UsernamePasswordResponseMessage(true));
}
origin: fengyouchao/sockslib

@Override
public void doMethod(Session session) throws SocksException, IOException {
 checkNotNull(session, "Argument [session] may not be null");
 checkNotNull(authenticator, "Please set an authenticator");
 UsernamePasswordMessage usernamePasswordMessage = new UsernamePasswordMessage();
 session.read(usernamePasswordMessage);
 logger.debug("SESSION[{}] Receive credentials: {}", session.getId(), usernamePasswordMessage
   .getUsernamePasswordCredentials());
 try {
  authenticator.doAuthenticate(usernamePasswordMessage.getUsernamePasswordCredentials(),
    session);
 } catch (AuthenticationException e) {
  session.write(new UsernamePasswordResponseMessage(false));
  throw e;
 }
 session.write(new UsernamePasswordResponseMessage(true));
}
origin: theotherp/nzbhydra2

@Override
public void doBind(Session session, CommandMessage commandMessage) throws SocksException,
    IOException {
  ServerSocket serverSocket = new ServerSocket(commandMessage.getPort());
  int bindPort = serverSocket.getLocalPort();
  Socket socket = null;
  logger.info("Create TCP server bind at {} for session[{}]", serverSocket
      .getLocalSocketAddress(), session.getId());
  session.write(new CommandResponseMessage(VERSION, ServerReply.SUCCEEDED, serverSocket
      .getInetAddress(), bindPort));
  socket = serverSocket.accept();
  session.write(new CommandResponseMessage(VERSION, ServerReply.SUCCEEDED, socket
      .getLocalAddress(), socket.getLocalPort()));
  Pipe pipe = new SocketPipe(session.getSocket(), socket);
  pipe.setBufferSize(bufferSize);
  pipe.start();
  // wait for pipe exit.
  while (pipe.isRunning()) {
    try {
      Thread.sleep(idleTime);
    } catch (InterruptedException e) {
      pipe.stop();
      session.close();
      logger.info("Session[{}] closed", session.getId());
    }
  }
  serverSocket.close();
  // throw new NotImplementException("Not implement BIND command");
}
origin: fengyouchao/sockslib

@Override
public void doBind(Session session, CommandMessage commandMessage) throws SocksException,
  IOException {
 ServerSocket serverSocket = new ServerSocket(commandMessage.getPort());
 int bindPort = serverSocket.getLocalPort();
 Socket socket = null;
 logger.info("Create TCP server bind at {} for session[{}]", serverSocket
   .getLocalSocketAddress(), session.getId());
 session.write(new CommandResponseMessage(VERSION, ServerReply.SUCCEEDED, serverSocket
   .getInetAddress(), bindPort));
 socket = serverSocket.accept();
 session.write(new CommandResponseMessage(VERSION, ServerReply.SUCCEEDED, socket
   .getLocalAddress(), socket.getLocalPort()));
 Pipe pipe = new SocketPipe(session.getSocket(), socket);
 pipe.setBufferSize(bufferSize);
 pipe.start();
 // wait for pipe exit.
 while (pipe.isRunning()) {
  try {
   Thread.sleep(idleTime);
  } catch (InterruptedException e) {
   pipe.stop();
   session.close();
   logger.info("Session[{}] closed", session.getId());
  }
 }
 serverSocket.close();
 // throw new NotImplementException("Not implement BIND command");
}
origin: theotherp/nzbhydra2

@Override
public void doUDPAssociate(Session session, CommandMessage commandMessage) throws
    SocksException, IOException {
  UDPRelayServer udpRelayServer =
      new UDPRelayServer(((InetSocketAddress) session.getClientAddress()).getAddress(),
          commandMessage.getPort());
  InetSocketAddress socketAddress = (InetSocketAddress) udpRelayServer.start();
  logger.info("Create UDP relay server at[{}] for {}", socketAddress, commandMessage
      .getSocketAddress());
  session.write(new CommandResponseMessage(VERSION, ServerReply.SUCCEEDED, InetAddress
      .getLocalHost(), socketAddress.getPort()));
  while (udpRelayServer.isRunning()) {
    try {
      Thread.sleep(idleTime);
    } catch (InterruptedException e) {
      session.close();
      logger.info("Session[{}] closed", session.getId());
    }
    if (session.isClose()) {
      udpRelayServer.stop();
      logger.debug("UDP relay server for session[{}] is closed", session.getId());
    }
  }
}
origin: fengyouchao/sockslib

@Override
public void doUDPAssociate(Session session, CommandMessage commandMessage) throws
  SocksException, IOException {
 UDPRelayServer udpRelayServer =
   new UDPRelayServer(((InetSocketAddress) session.getClientAddress()).getAddress(),
     commandMessage.getPort());
 InetSocketAddress socketAddress = (InetSocketAddress) udpRelayServer.start();
 logger.info("Create UDP relay server at[{}] for {}", socketAddress, commandMessage
   .getSocketAddress());
 session.write(new CommandResponseMessage(VERSION, ServerReply.SUCCEEDED, InetAddress
   .getLocalHost(), socketAddress.getPort()));
 while (udpRelayServer.isRunning()) {
  try {
   Thread.sleep(idleTime);
  } catch (InterruptedException e) {
   session.close();
   logger.info("Session[{}] closed", session.getId());
  }
  if (session.isClose()) {
   udpRelayServer.stop();
   logger.debug("UDP relay server for session[{}] is closed", session.getId());
  }
 }
}
origin: theotherp/nzbhydra2

session.write(responseMessage);
if (reply != ServerReply.SUCCEEDED) { // 如果返回失败信息,则退出该方法。
  session.close();
origin: fengyouchao/sockslib

session.write(responseMessage);
if (reply != ServerReply.SUCCEEDED) { // 如果返回失败信息,则退出该方法。
 session.close();
origin: fengyouchao/sockslib

session.write(new MethodSelectionResponseMessage(VERSION, selectedMethod));
 session.write(new CommandResponseMessage(serverReply));
 logger.info("SESSION[{}] will close, because {}", session.getId(), serverReply);
 return;
origin: theotherp/nzbhydra2

session.write(new MethodSelectionResponseMessage(VERSION, selectedMethod));
  session.write(new CommandResponseMessage(serverReply));
  logger.info("SESSION[{}] will close, because {}", session.getId(), serverReply);
  return;
sockslib.serverSessionwrite

Javadoc

Writes Message in output stream.

Popular methods of Session

  • close
    Closes connection and removes itself from managed sessions.
  • getClientAddress
    Get remote host's IP address and port.
  • getId
    Gets session ID.
  • getSocket
    Returns socket.
  • isClose
    Returns true if the session is closed.
  • read
    Read a buffer.
  • setAttribute

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getContentResolver (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
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