Mercurial > 510Connectbot
diff src/ch/ethz/ssh2/transport/ClientServerHello.java @ 307:071eccdff8ea ganymed
fix java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 14:16:58 -0700 |
parents | 91a31873c42a |
children | 097cfe8770dd |
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/transport/ClientServerHello.java Wed Jul 30 12:09:51 2014 -0700 +++ b/src/ch/ethz/ssh2/transport/ClientServerHello.java Wed Jul 30 14:16:58 2014 -0700 @@ -27,35 +27,37 @@ } public static ClientServerHello clientHello(String softwareversion, InputStream bi, OutputStream bo) - throws IOException { + throws IOException { return exchange(softwareversion, bi, bo, true); } public static ClientServerHello serverHello(String softwareversion, InputStream bi, OutputStream bo) - throws IOException { + throws IOException { return exchange(softwareversion, bi, bo, false); } private static ClientServerHello exchange(String softwareversion, InputStream bi, OutputStream bo, boolean clientMode) - throws IOException { + throws IOException { String localIdentifier = String.format("SSH-2.0-%s", softwareversion); - bo.write(StringEncoder.GetBytes(String.format("%s\r\n", localIdentifier))); bo.flush(); - // Expect SSH-protoversion-softwareversion SP comments CR LF String remoteIdentifier = new LineNumberReader(new InputStreamReader(bi)).readLine(); - if(null == remoteIdentifier) { + + if (null == remoteIdentifier) { throw new IOException("Premature connection close"); } - if(!remoteIdentifier.startsWith("SSH-")) { + + if (!remoteIdentifier.startsWith("SSH-")) { throw new IOException(String.format("Malformed SSH identification %s", remoteIdentifier)); } - if(!remoteIdentifier.startsWith("SSH-1.99-") + + if (!remoteIdentifier.startsWith("SSH-1.99-") && !remoteIdentifier.startsWith("SSH-2.0-")) { throw new IOException(String.format("Incompatible remote protocol version %s", remoteIdentifier)); } - if(clientMode) { + + if (clientMode) { return new ClientServerHello(localIdentifier, remoteIdentifier); } else {