Code example for SSLSocket

Methods: setEnabledProtocols, setKeepAlive, setUseClientMode, startHandshake

0
			NoSuchProviderException { 
 
		final SSLSocketFactory factory = getSocketFactory();
		final SSLSocket sslSocket = (SSLSocket) factory.createSocket(
				hostAddress, port);
		sslSocket.setUseClientMode(true);
		sslSocket.setKeepAlive(true);
		// sslSocket.setSoTimeout(120000); 
		sslSocket.setEnabledProtocols(new String[] { "TLSv1" });
		sslSocket.startHandshake();
 
		Globals.logInfo(this, "TCP/SSL socket opened");
 
		return sslSocket;
	} 
 
	protected DatagramSocket connectUdp() throws SocketException,
			UnknownHostException { 
		udpSocket = new DatagramSocket();
		udpSocket.connect(hostAddress, port);