comparison src/org/tn5250j/framework/transport/SocketConnector.java @ 10:e773d0952613 tn5250

adding tn5250 files
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 16:11:14 -0700
parents 3b760b39962a
children 5949eb469a79
comparison
equal deleted inserted replaced
9:731e70088af0 10:e773d0952613
22 * 22 *
23 */ 23 */
24 package org.tn5250j.framework.transport; 24 package org.tn5250j.framework.transport;
25 25
26 import java.net.Socket; 26 import java.net.Socket;
27
28 import com.five_ten_sg.connectbot.service.TerminalBridge;
29 import com.five_ten_sg.connectbot.service.TerminalManager;
27 30
28 import org.tn5250j.framework.transport.SSL.SSLImplementation; 31 import org.tn5250j.framework.transport.SSL.SSLImplementation;
29 import org.tn5250j.TN5250jConstants; 32 import org.tn5250j.TN5250jConstants;
30 import org.tn5250j.tools.logging.TN5250jLogFactory; 33 import org.tn5250j.tools.logging.TN5250jLogFactory;
31 import org.tn5250j.tools.logging.TN5250jLogger; 34 import org.tn5250j.tools.logging.TN5250jLogger;
60 * specified type will be created. 63 * specified type will be created.
61 * @param destination 64 * @param destination
62 * @param port 65 * @param port
63 * @return a new client socket, or null if 66 * @return a new client socket, or null if
64 */ 67 */
65 public Socket createSocket(String destination, int port) { 68 public Socket createSocket(String destination, int port, TerminalBridge bridge, TerminalManager manager) {
66 69
67 Socket socket = null; 70 Socket socket = null;
68 Exception ex = null; 71 Exception ex = null;
69 72
70 if (sslType == null || sslType.trim().length() == 0 || 73 if (sslType == null || sslType.trim().length() == 0 ||
81 logger.info("Creating SSL ["+sslType+"] Socket"); 84 logger.info("Creating SSL ["+sslType+"] Socket");
82 85
83 SSLInterface sslIf = null; 86 SSLInterface sslIf = null;
84 87
85 try { 88 try {
86 sslIf = (SSLInterface) new SSLImplementation(); 89 sslIf = (SSLInterface) new SSLImplementation(bridge, manager);
87 } catch (Exception e) { 90 } catch (Exception e) {
88 ex = new Exception("Failed to create SSLInterface Instance. " + 91 ex = new Exception("Failed to create SSLInterface Instance. " +
89 "Message is ["+e.getMessage()+"]"); 92 "Message is ["+e.getMessage()+"]");
90 } 93 }
91 94
92 if (sslIf != null) { 95 if (sslIf != null) {
93 sslIf.init(sslType); 96 sslIf.init(sslType);
94 socket = sslIf.createSSLSocket(destination,port); 97 socket = sslIf.createSSLSocket(destination, port);
95 } 98 }
96 } 99 }
97 100
98 if (ex != null) { 101 if (ex != null) {
99 logger.error(ex); 102 logger.error(ex);