All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.figo.internal.FigoSocketFactory Maven / Gradle / Ivy

Go to download

This SDK eases the development of Java applications and web services consuming the figo connect API. Figo connect allows developers simple access to users bank data on a trustworthy basis. Users can grant your application access to certain parts of their bank accounts and you can access them without worrying about the inner workings of online banking.

The newest version!
package me.figo.internal;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;

public class FigoSocketFactory extends SSLSocketFactory {

	private static final String[] ENABLED_PROTOCOLS = { "TLSv1.2" };

	private SSLSocketFactory isf;

	public FigoSocketFactory(SSLSocketFactory factory) {
		isf = factory;
	}

	@Override
	public String[] getDefaultCipherSuites() {
		return isf.getDefaultCipherSuites();
	}

	@Override
	public String[] getSupportedCipherSuites() {
		return isf.getSupportedCipherSuites();
	}

	@Override
	public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
		return enableProtocols(isf.createSocket(socket, host, port, autoClose));
	}

	@Override
	public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
		return enableProtocols(isf.createSocket(host, port));
	}

	@Override
	public Socket createSocket(String remoteHost, int remotePort, InetAddress localHost, int localPort)
			throws IOException, UnknownHostException {
		return enableProtocols(isf.createSocket(remoteHost, remotePort, localHost, localPort));
	}

	@Override
	public Socket createSocket(InetAddress host, int port) throws IOException {
		return enableProtocols(isf.createSocket(host, port));
	}

	@Override
	public Socket createSocket(InetAddress remoteHost, int remotePort, InetAddress localHost, int localPort)
			throws IOException {
		return enableProtocols(isf.createSocket(remoteHost, remotePort, localHost, localPort));
	}

	private Socket enableProtocols(Socket socket) {
		if (socket != null && socket instanceof SSLSocket) {
			((SSLSocket) socket).setEnabledProtocols(ENABLED_PROTOCOLS);
		}
		return socket;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy