/** * This method will throw a {@link AuthenticationException} * * @param session Current session * @throws AuthenticationException {@link AuthenticationException} */ protected void authenticationFailed(Session session) throws AuthenticationException { throw new AuthenticationException( "Authentication failed, client from " + session.getClientAddress()); }
/** * This method will throw a {@link AuthenticationException} * * @param session Current session * @throws AuthenticationException {@link AuthenticationException} */ protected void authenticationFailed(Session session) throws AuthenticationException { throw new AuthenticationException( "Authentication failed, client from " + session.getClientAddress()); }
@Override public void onCreate(Session session) throws CloseSessionException { logger.info("Create SESSION[{}] for {}", session.getId(), session.getClientAddress()); }
@Override public void onCreate(Session session) throws CloseSessionException { logger.info("Create SESSION[{}] for {}", session.getId(), session.getClientAddress()); }
@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()); } } }
@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()); } } }