com.microsoft.tfs.core.config.httpclient.internal
Class DefaultSSLProtocolSocketFactory

java.lang.Object
  extended by com.microsoft.tfs.core.config.httpclient.internal.DefaultSSLProtocolSocketFactory
All Implemented Interfaces:
ProtocolSocketFactory, SecureProtocolSocketFactory

public class DefaultSSLProtocolSocketFactory
extends java.lang.Object
implements SecureProtocolSocketFactory

An SSL socket factory for HTTPClient that tweaks certificate validation, either providing the ability to accept self-signed certificates, or one that includes additional certificates (notably newer well-trusted certificates like the Microsoft Internet Authority certificate, vital for connecting to Azure-hosted TFS servers on platforms that lack the updated Microsoft Internet Authority cert.)


Field Summary
static java.lang.String ACCEPT_UNTRUSTED_CERTIFICATES_PARAMETER
           
static java.lang.String DISABLE_PROPERTY_NAME
           
 
Constructor Summary
DefaultSSLProtocolSocketFactory()
           
 
Method Summary
 java.net.Socket createSocket(java.net.Socket socket, java.lang.String host, int port, HttpConnectionParams params, boolean autoClose)
          Returns a socket connected to the given host that is layered over an existing socket.
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpConnectionParams params)
          Gets a new socket connection to the given host.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_UNTRUSTED_CERTIFICATES_PARAMETER

public static final java.lang.String ACCEPT_UNTRUSTED_CERTIFICATES_PARAMETER
Constant Field Value:
"DefaultSSLProtocolSocketFactory.acceptUntrustedCertificates"
See Also:
Constant Field Values

DISABLE_PROPERTY_NAME

public static final java.lang.String DISABLE_PROPERTY_NAME
Constant Field Value:
"com.microsoft.tfs.core.config.httpclient.sslsocketfactory.disable"
See Also:
Constant Field Values
Constructor Detail

DefaultSSLProtocolSocketFactory

public DefaultSSLProtocolSocketFactory()
Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress localAddress,
                                    int localPort,
                                    HttpConnectionParams params)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    ConnectTimeoutException
Gets a new socket connection to the given host.

Specified by:
createSocket in interface ProtocolSocketFactory
Parameters:
host - the host name/IP
port - the port on the host
localAddress - the local host name/IP to bind the socket to
localPort - the port on the local machine
params - Http connection parameters
Returns:
Socket a new socket
Throws:
java.io.IOException - if an I/O error occurs while creating the socket
java.net.UnknownHostException - if the IP address of the host cannot be determined
ConnectTimeoutException - if socket cannot be connected within the given time limit

createSocket

public java.net.Socket createSocket(java.net.Socket socket,
                                    java.lang.String host,
                                    int port,
                                    HttpConnectionParams params,
                                    boolean autoClose)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Returns a socket connected to the given host that is layered over an existing socket. Used primarily for creating secure sockets through proxies.

Specified by:
createSocket in interface SecureProtocolSocketFactory
Parameters:
socket - the existing socket
host - the host name/IP
port - the port on the host
autoClose - a flag for closing the underling socket when the created socket is closed
Returns:
Socket a new socket
Throws:
java.io.IOException - if an I/O error occurs while creating the socket
java.net.UnknownHostException - if the IP address of the host cannot be determined


© 2015 Microsoft. All rights reserved.