Code example for SocketFactory

Methods: createSocket

			return new AndroidSSLSocketFactory(sslContext);
	protected Socket newSocket(boolean pSSL, String pHostName, int pPort) throws UnknownHostException, IOException {
		final Socket s = socketFactory.createSocket(pHostName, pPort);
		if(pSSL) {
			return getSSLSocketFactory().createSocket(s, pHostName, pPort, true);
		} else { 
			return s;
	private static final String userAgent = USER_AGENT + " (Lite HTTP Transport)";
	private boolean ssl;
	private String hostname;
	private String host;
	private int port;
	private String uri;
	private Socket socket;
Connect your IDE to all the code out there  Get Codota for Java