mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 08:10:55 +03:00
reformat
This commit is contained in:
@@ -25,7 +25,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/** An abstract class for {@link Service} that implements common or default functionality. */
|
/** An abstract class for {@link Service} that implements common or default functionality. */
|
||||||
public abstract class AbstractService implements Service {
|
public abstract class AbstractService
|
||||||
|
implements Service {
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
@@ -51,7 +52,8 @@ public abstract class AbstractService implements Service {
|
|||||||
return this.timeout;
|
return this.timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(Message msg, SSHPacket buf) throws SSHException {
|
public void handle(Message msg, SSHPacket buf)
|
||||||
|
throws SSHException {
|
||||||
trans.sendUnimplemented();
|
trans.sendUnimplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,11 +61,13 @@ public abstract class AbstractService implements Service {
|
|||||||
log.debug("Was notified of {}", error.toString());
|
log.debug("Was notified of {}", error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyUnimplemented(long seqNum) throws SSHException {
|
public void notifyUnimplemented(long seqNum)
|
||||||
|
throws SSHException {
|
||||||
throw new SSHException(DisconnectReason.PROTOCOL_ERROR, "Unexpected: SSH_MSG_UNIMPLEMENTED");
|
throw new SSHException(DisconnectReason.PROTOCOL_ERROR, "Unexpected: SSH_MSG_UNIMPLEMENTED");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void request() throws TransportException {
|
public void request()
|
||||||
|
throws TransportException {
|
||||||
final Service active = trans.getService();
|
final Service active = trans.getService();
|
||||||
if (!equals(active))
|
if (!equals(active))
|
||||||
if (name.equals(active.getName()))
|
if (name.equals(active.getName()))
|
||||||
@@ -76,7 +80,8 @@ public abstract class AbstractService implements Service {
|
|||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyDisconnect() throws SSHException {
|
public void notifyDisconnect()
|
||||||
|
throws SSHException {
|
||||||
log.debug("Was notified of disconnect");
|
log.debug("Was notified of disconnect");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ConfigImpl implements Config {
|
public class ConfigImpl
|
||||||
|
implements Config {
|
||||||
|
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ import java.util.List;
|
|||||||
* [1] It is worth noting that Sun's JRE does not have the unlimited cryptography extension enabled by default. This
|
* [1] It is worth noting that Sun's JRE does not have the unlimited cryptography extension enabled by default. This
|
||||||
* prevents using ciphers with strength greater than 128.
|
* prevents using ciphers with strength greater than 128.
|
||||||
*/
|
*/
|
||||||
public class DefaultConfig extends ConfigImpl {
|
public class DefaultConfig
|
||||||
|
extends ConfigImpl {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ public class DefaultConfig extends ConfigImpl {
|
|||||||
|
|
||||||
protected void initMACFactories() {
|
protected void initMACFactories() {
|
||||||
setMACFactories(new HMACSHA1.Factory(), new HMACSHA196.Factory(), new HMACMD5.Factory(),
|
setMACFactories(new HMACSHA1.Factory(), new HMACSHA196.Factory(), new HMACMD5.Factory(),
|
||||||
new HMACMD596.Factory());
|
new HMACMD596.Factory());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initCompressionFactories() {
|
protected void initCompressionFactories() {
|
||||||
|
|||||||
@@ -97,15 +97,18 @@ abstract class SocketClient {
|
|||||||
connect(InetAddress.getByName(hostname), port, localAddr, localPort);
|
connect(InetAddress.getByName(hostname), port, localAddr, localPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect(InetAddress host) throws SocketException, IOException {
|
public void connect(InetAddress host)
|
||||||
|
throws SocketException, IOException {
|
||||||
connect(host, defaultPort);
|
connect(host, defaultPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect(String hostname) throws SocketException, IOException {
|
public void connect(String hostname)
|
||||||
|
throws SocketException, IOException {
|
||||||
connect(hostname, defaultPort);
|
connect(hostname, defaultPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect() throws IOException {
|
public void disconnect()
|
||||||
|
throws IOException {
|
||||||
if (socket != null) {
|
if (socket != null) {
|
||||||
socket.close();
|
socket.close();
|
||||||
socket = null;
|
socket = null;
|
||||||
@@ -197,7 +200,8 @@ abstract class SocketClient {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onConnect() throws IOException {
|
void onConnect()
|
||||||
|
throws IOException {
|
||||||
socket.setSoTimeout(timeout);
|
socket.setSoTimeout(timeout);
|
||||||
input = socket.getInputStream();
|
input = socket.getInputStream();
|
||||||
output = socket.getOutputStream();
|
output = socket.getOutputStream();
|
||||||
|
|||||||
Reference in New Issue
Block a user