Not clear what you are attempting to do - however, after calling sshServer.start() you need to "hang" - e.g
sshServer.start(); while (true) Thread.sleep(Long.MAX_VALUE); ________________________________ From: 祝居旺 <zhujuw...@aspirecn.com> Sent: Monday, October 9, 2017 1:09 PM To: dev@mina.apache.org Subject: Emergency help ! ! ! Dear, apache : I have already setup a SshServer and bind the port "4022". How can I write to each client's request? Such as socket code follow this : ServerSocket serverSocket = new ServerSocket(4022,3); while (true) { Socket socket = serverSocket.accept(); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); } More anxious, can you help me ? My code as follows : try { URL xmlpath = SpringApplication.class.getClassLoader().getResource("dsproxy.pem"); System.out.println(xmlpath.getPath()); String hostKeyType = AbstractGeneratorHostKeyProvider.DEFAULT_ALGORITHM; int hostKeySize = 0; SshServer sshServer = SshServer.setUpDefaultServer(); sshServer.setPort(4022); Map<String, Object> props = sshServer.getProperties(); props.putAll(new HashMap<>()); List<String> keyFiles = new LinkedList(); if(xmlpath != null) { keyFiles.add(xmlpath.getPath().substring(1)); } KeyPairProvider keyPairProvider = sshServer.setupServerKeys(sshServer, hostKeyType, hostKeySize, keyFiles); sshServer.setKeyPairProvider(keyPairProvider); sshServer.setupServerBanner(sshServer, new HashMap<>()); sshServer.setPasswordAuthenticator(new JakiroAuthenticator()); sshServer.setCommandFactory(new ScpCommandFactory.Builder().withDelegate( commandString -> new ProcessShellFactory(GenericUtils.split(commandString, ' ')).create() ).build()); sshServer.start(); }catch (Exception e) { logger.error("set up server error:", e); }