private SocketConnector createRawSocket( String host, int port, boolean secure, int timeout) throws IOException { // Determine the port number. Especially, if 'port' is -1, // it is converted to 80 or 443. port = determinePort(port, secure); // True if a proxy server should be used. boolean proxied = (mProxySettings.getHost() != null); // See "Figure 2 -- Proxy server traversal decision tree" at // http://www.infoq.com/articles/Web-Sockets-Proxy-Servers if (proxied) { // Create a connector to connect to the proxy server. return createProxiedRawSocket(host, port, secure, timeout); } else { // Create a connector to connect to the WebSocket endpoint directly. return createDirectRawSocket(host, port, secure, timeout); } }
private SocketConnector createRawSocket( String host, int port, boolean secure, int timeout) throws IOException { // Determine the port number. Especially, if 'port' is -1, // it is converted to 80 or 443. port = determinePort(port, secure); // True if a proxy server should be used. boolean proxied = (mProxySettings.getHost() != null); // See "Figure 2 -- Proxy server traversal decision tree" at // http://www.infoq.com/articles/Web-Sockets-Proxy-Servers if (proxied) { // Create a connector to connect to the proxy server. return createProxiedRawSocket(host, port, secure, timeout); } else { // Create a connector to connect to the WebSocket endpoint directly. return createDirectRawSocket(host, port, secure, timeout); } }