Mercurial > 510Connectbot
diff src/org/tn5250j/framework/transport/SocketConnector.java @ 112:77ac18bc1b2f
cleanup java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 18 Jun 2014 13:03:01 -0700 |
parents | 33eb63352be5 |
children |
line wrap: on
line diff
--- a/src/org/tn5250j/framework/transport/SocketConnector.java Wed Jun 18 13:00:19 2014 -0700 +++ b/src/org/tn5250j/framework/transport/SocketConnector.java Wed Jun 18 13:03:01 2014 -0700 @@ -36,61 +36,63 @@ public class SocketConnector { private static final String TAG = "SocketConnector"; - /** - * Creates a new instance that creates a plain socket by default. - */ - public SocketConnector() { - - } + /** + * Creates a new instance that creates a plain socket by default. + */ + public SocketConnector() { + } - /** - * Create a new client Socket to the given destination, port and sslType of - * encryption. - * @param destination - * @param port - * @return a new client socket, or null if - */ - public Socket createSocket(String destination, int port, String sslType, String homeDirectory, TerminalBridge bridge, TerminalManager manager) { + /** + * Create a new client Socket to the given destination, port and sslType of + * encryption. + * @param destination + * @param port + * @return a new client socket, or null if + */ + public Socket createSocket(String destination, int port, String sslType, String homeDirectory, TerminalBridge bridge, TerminalManager manager) { + Socket socket = null; + Exception ex = null; - Socket socket = null; - Exception ex = null; + if (sslType == null || sslType.trim().length() == 0 || + sslType.toUpperCase().equals(TN5250jConstants.SSL_TYPE_NONE)) { + Log.i(TAG, "Creating Plain Socket"); - if (sslType == null || sslType.trim().length() == 0 || - sslType.toUpperCase().equals(TN5250jConstants.SSL_TYPE_NONE)) { - Log.i(TAG,"Creating Plain Socket"); - try { - // Use Socket Constructor!!! SocketFactory for jdk 1.4 - socket = new Socket(destination,port); - } catch (Exception e) { - ex = e; - } - } else { //SSL SOCKET - - Log.i(TAG,"Creating SSL ["+sslType+"] Socket"); - - SSLInterface sslIf = null; + try { + // Use Socket Constructor!!! SocketFactory for jdk 1.4 + socket = new Socket(destination, port); + } + catch (Exception e) { + ex = e; + } + } + else { //SSL SOCKET + Log.i(TAG, "Creating SSL [" + sslType + "] Socket"); + SSLInterface sslIf = null; - try { - sslIf = (SSLInterface) new SSLImplementation(bridge, manager); - } catch (Exception e) { - ex = new Exception("Failed to create SSLInterface Instance. " + - "Message is ["+e.getMessage()+"]"); - } + try { + sslIf = (SSLInterface) new SSLImplementation(bridge, manager); + } + catch (Exception e) { + ex = new Exception("Failed to create SSLInterface Instance. " + + "Message is [" + e.getMessage() + "]"); + } - if (sslIf != null) { - sslIf.init(sslType, homeDirectory); - socket = sslIf.createSSLSocket(destination, port); - } - } + if (sslIf != null) { + sslIf.init(sslType, homeDirectory); + socket = sslIf.createSSLSocket(destination, port); + } + } - if (ex != null) { - Log.e(TAG, "exception", ex); - } - if (socket == null) { - Log.w(TAG, "No socket was created"); - } - return socket; - } + if (ex != null) { + Log.e(TAG, "exception", ex); + } + + if (socket == null) { + Log.w(TAG, "No socket was created"); + } + + return socket; + } } \ No newline at end of file