comparison src/org/tn5250j/framework/transport/SocketConnector.java @ 91:33eb63352be5

remove 5250 configuration
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jun 2014 16:17:48 -0700
parents b29b39f386a4
children 77ac18bc1b2f
comparison
equal deleted inserted replaced
90:3f587bd647a5 91:33eb63352be5
33 import android.util.Log; 33 import android.util.Log;
34 34
35 35
36 public class SocketConnector { 36 public class SocketConnector {
37 private static final String TAG = "SocketConnector"; 37 private static final String TAG = "SocketConnector";
38 String sslType = null;
39 38
40 /** 39 /**
41 * Creates a new instance that creates a plain socket by default. 40 * Creates a new instance that creates a plain socket by default.
42 */ 41 */
43 public SocketConnector() { 42 public SocketConnector() {
44 43
45 } 44 }
46 45
47 /** 46 /**
48 * Set the type of SSL connection to use. Specify null or an empty string 47 * Create a new client Socket to the given destination, port and sslType of
49 * to use a plain socket. 48 * encryption.
50 * @param type The SSL connection type
51 * @see org.tn5250j.framework.transport.SSLConstants
52 */
53 public void setSSLType(String type) {
54 sslType = type;
55 }
56
57 /**
58 * Create a new client Socket to the given destination and port. If an SSL
59 * socket type has not been specified <i>(by setSSLType(String))</i>, then
60 * a plain socket will be created. Otherwise, a new SSL socket of the
61 * specified type will be created.
62 * @param destination 49 * @param destination
63 * @param port 50 * @param port
64 * @return a new client socket, or null if 51 * @return a new client socket, or null if
65 */ 52 */
66 public Socket createSocket(String destination, int port, TerminalBridge bridge, TerminalManager manager) { 53 public Socket createSocket(String destination, int port, String sslType, String homeDirectory, TerminalBridge bridge, TerminalManager manager) {
67 54
68 Socket socket = null; 55 Socket socket = null;
69 Exception ex = null; 56 Exception ex = null;
70 57
71 if (sslType == null || sslType.trim().length() == 0 || 58 if (sslType == null || sslType.trim().length() == 0 ||
89 ex = new Exception("Failed to create SSLInterface Instance. " + 76 ex = new Exception("Failed to create SSLInterface Instance. " +
90 "Message is ["+e.getMessage()+"]"); 77 "Message is ["+e.getMessage()+"]");
91 } 78 }
92 79
93 if (sslIf != null) { 80 if (sslIf != null) {
94 sslIf.init(sslType); 81 sslIf.init(sslType, homeDirectory);
95 socket = sslIf.createSSLSocket(destination, port); 82 socket = sslIf.createSSLSocket(destination, port);
96 } 83 }
97 } 84 }
98 85
99 if (ex != null) { 86 if (ex != null) {