diff --git a/src/main/java/net/schmizz/sshj/AbstractService.java b/src/main/java/net/schmizz/sshj/AbstractService.java index 7a22af2e..b58e6824 100644 --- a/src/main/java/net/schmizz/sshj/AbstractService.java +++ b/src/main/java/net/schmizz/sshj/AbstractService.java @@ -48,10 +48,6 @@ public abstract class AbstractService return name; } - public int getTimeout() { - return this.timeout; - } - public void handle(Message msg, SSHPacket buf) throws SSHException { trans.sendUnimplemented(); @@ -66,6 +62,11 @@ public abstract class AbstractService throw new SSHException(DisconnectReason.PROTOCOL_ERROR, "Unexpected: SSH_MSG_UNIMPLEMENTED"); } + public void notifyDisconnect() + throws SSHException { + log.debug("Was notified of disconnect"); + } + public void request() throws TransportException { final Service active = trans.getService(); @@ -76,13 +77,12 @@ public abstract class AbstractService trans.reqService(this); } + public int getTimeout() { + return this.timeout; + } + public void setTimeout(int timeout) { this.timeout = timeout; } - public void notifyDisconnect() - throws SSHException { - log.debug("Was notified of disconnect"); - } - } diff --git a/src/main/java/net/schmizz/sshj/Config.java b/src/main/java/net/schmizz/sshj/Config.java index a06b8cfe..3016b82f 100644 --- a/src/main/java/net/schmizz/sshj/Config.java +++ b/src/main/java/net/schmizz/sshj/Config.java @@ -142,4 +142,5 @@ public interface Config { * @param version software version info */ void setVersion(String version); + } diff --git a/src/main/java/net/schmizz/sshj/common/Message.java b/src/main/java/net/schmizz/sshj/common/Message.java index e9b59fe1..cc9fa8e6 100644 --- a/src/main/java/net/schmizz/sshj/common/Message.java +++ b/src/main/java/net/schmizz/sshj/common/Message.java @@ -63,19 +63,19 @@ public enum Message { private final byte b; - private static final Message[] commands = new Message[256]; + private static final Message[] cache = new Message[256]; static { for (Message c : Message.values()) - if (commands[c.toByte()] == null) - commands[c.toByte()] = c; + if (cache[c.toByte()] == null) + cache[c.toByte()] = c; } public static Message fromByte(byte b) { - return commands[b]; + return cache[b]; } - Message(int b) { + private Message(int b) { this.b = (byte) b; } diff --git a/src/main/java/net/schmizz/sshj/connection/Connection.java b/src/main/java/net/schmizz/sshj/connection/Connection.java index cecbd3a8..a6f3ec62 100644 --- a/src/main/java/net/schmizz/sshj/connection/Connection.java +++ b/src/main/java/net/schmizz/sshj/connection/Connection.java @@ -119,13 +119,19 @@ public interface Connection { /** * Set the maximum packet size for the local window this connection recommends to any {@link Channel}'s that ask for * it. + * + * @param maxPacketSize maximum packet size in bytes */ void setMaxPacketSize(int maxPacketSize); - /** Get the size for the local window this connection recommends to any {@link Channel}'s that ask for it. */ + /** @return the size for the local window this connection recommends to any {@link Channel}'s that ask for it. */ int getWindowSize(); - /** Set the size for the local window this connection recommends to any {@link Channel}'s that ask for it. */ + /** + * Set the size for the local window this connection recommends to any {@link Channel}'s that ask for it. + * + * @param windowSize window size in bytes + */ void setWindowSize(int windowSize); /** @return the associated {@link Transport}. */ diff --git a/src/main/java/net/schmizz/sshj/transport/Proposal.java b/src/main/java/net/schmizz/sshj/transport/Proposal.java index 0e5a869f..23f9a6ff 100644 --- a/src/main/java/net/schmizz/sshj/transport/Proposal.java +++ b/src/main/java/net/schmizz/sshj/transport/Proposal.java @@ -134,7 +134,6 @@ class Proposal { public SSHPacket getPacket() { return new SSHPacket(packet); - } public NegotiatedAlgorithms negotiate(Proposal other)