// Path: src/main/java/io/openio/sds/exceptions/OioException.java
// @SuppressWarnings("deprecation")
// public class OioException extends SdsException {
// 
//     /**
//      * 
//      */
//     private static final long serialVersionUID = 3270900242235005338L;
// 
//     public OioException(String message) {
//         super(message);
//     }
// 
//     public OioException(String message, Throwable t) {
//         super(message, t);
//     }
// }
// 
// Path: src/main/java/io/openio/sds/http/OioHttpSettings.java
// public class OioHttpSettings {
// 
// 	private Integer sendBufferSize = 131072;
// 	private Integer receiveBufferSize = 131072;
// 	private Boolean setSocketBufferSize = false;
// 	private Integer connectTimeout = 30000;
// 	private Integer readTimeout = 60000;
// 	private String userAgent = "oio-http";
// 
// 	public OioHttpSettings() {
// 	}
// 
// 	public Integer sendBufferSize() {
// 		return sendBufferSize;
// 	}
// 
// 	public OioHttpSettings sendBufferSize(Integer sendBufferSize) {
// 		this.sendBufferSize = sendBufferSize;
// 		return this;
// 	}
// 
// 	public Integer receiveBufferSize() {
// 		return receiveBufferSize;
// 	}
// 
// 	public OioHttpSettings receiveBufferSize(Integer receiveBufferSize) {
// 		this.receiveBufferSize = receiveBufferSize;
// 		return this;
// 	}
// 
//     /**
//      * Should the size of the socket buffers be explicitly set?
//      * When true, explicitly set the send buffer size (resp. receive buffer
//      * size) to {@link #sendBufferSize} (resp. {@link #receiveBufferSize}).
//      * When false, let the kernel adjust the size automatically.
//      *
//      * @return true when the API should set the socket buffer sizes,
//      *  false when it should let the kernel decide.
//      */
//     public Boolean setSocketBufferSize() {
//         return this.setSocketBufferSize;
//     }
// 
//     /**
//      * Should the size of the socket buffers be explicitly set?
//      * When true, explicitly set the send buffer size (resp. receive buffer
//      * size) to {@link #sendBufferSize} (resp. {@link #receiveBufferSize}).
//      * When false, let the kernel adjust the size automatically.
//      *
//      * @param setSocketBufferSize
//      * @return this
//      */
//     public OioHttpSettings setSocketBufferSize(Boolean setSocketBufferSize) {
//         this.setSocketBufferSize = setSocketBufferSize;
//         return this;
//     }
// 
// 	public Integer connectTimeout() {
// 		return connectTimeout;
// 	}
// 
// 	public OioHttpSettings connectTimeout(Integer connectTimeout) {
// 		this.connectTimeout = connectTimeout;
// 		return this;
// 	}
// 
// 	public Integer readTimeout() {
// 		return readTimeout;
// 	}
// 
// 	public OioHttpSettings readTimeout(Integer readTimeout) {
// 		this.readTimeout = readTimeout;
// 		return this;
// 	}
// 
//     public String userAgent() {
//         return userAgent;
//     }
// 
//     public OioHttpSettings userAgent(String userAgent) {
//         this.userAgent = userAgent;
//         return this;
//     }
// }
// 
// Path: src/main/java/io/openio/sds/common/Check.java
// public static void checkArgument(boolean condition, String msg) {
//     if (!condition)
//         throw new IllegalArgumentException(msg);
// }


import static java.lang.String.format;
import io.openio.sds.exceptions.OioException;
import io.openio.sds.http.OioHttpSettings;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import static io.openio.sds.common.Check.checkArgument;
package io.openio.sds.common;



/**
 *
 * @author Florent Vennetier
 *
 */
public abstract class AbstractSocketProvider implements SocketProvider {

    /**
     * Configure an already created Socket with provided settings, and establish the connection.
     *
     * @param sock A Socket instance
     * @param target The address to connect the socket to
     * @param http The settings to apply
     * @throws OioException if an error occurs during connection
     */
    protected void configureAndConnect(Socket sock, InetSocketAddress target, OioHttpSettings http)
// Path: src/main/java/io/openio/sds/exceptions/OioException.java
// @SuppressWarnings("deprecation")
// public class OioException extends SdsException {
// 
//     /**
//      * 
//      */
//     private static final long serialVersionUID = 3270900242235005338L;
// 
//     public OioException(String message) {
//         super(message);
//     }
// 
//     public OioException(String message, Throwable t) {
//         super(message, t);
//     }
// }
// 
// Path: src/main/java/io/openio/sds/http/OioHttpSettings.java
// public class OioHttpSettings {
// 
// 	private Integer sendBufferSize = 131072;
// 	private Integer receiveBufferSize = 131072;
// 	private Boolean setSocketBufferSize = false;
// 	private Integer connectTimeout = 30000;
// 	private Integer readTimeout = 60000;
// 	private String userAgent = "oio-http";
// 
// 	public OioHttpSettings() {
// 	}
// 
// 	public Integer sendBufferSize() {
// 		return sendBufferSize;
// 	}
// 
// 	public OioHttpSettings sendBufferSize(Integer sendBufferSize) {
// 		this.sendBufferSize = sendBufferSize;
// 		return this;
// 	}
// 
// 	public Integer receiveBufferSize() {
// 		return receiveBufferSize;
// 	}
// 
// 	public OioHttpSettings receiveBufferSize(Integer receiveBufferSize) {
// 		this.receiveBufferSize = receiveBufferSize;
// 		return this;
// 	}
// 
//     /**
//      * Should the size of the socket buffers be explicitly set?
//      * When true, explicitly set the send buffer size (resp. receive buffer
//      * size) to {@link #sendBufferSize} (resp. {@link #receiveBufferSize}).
//      * When false, let the kernel adjust the size automatically.
//      *
//      * @return true when the API should set the socket buffer sizes,
//      *  false when it should let the kernel decide.
//      */
//     public Boolean setSocketBufferSize() {
//         return this.setSocketBufferSize;
//     }
// 
//     /**
//      * Should the size of the socket buffers be explicitly set?
//      * When true, explicitly set the send buffer size (resp. receive buffer
//      * size) to {@link #sendBufferSize} (resp. {@link #receiveBufferSize}).
//      * When false, let the kernel adjust the size automatically.
//      *
//      * @param setSocketBufferSize
//      * @return this
//      */
//     public OioHttpSettings setSocketBufferSize(Boolean setSocketBufferSize) {
//         this.setSocketBufferSize = setSocketBufferSize;
//         return this;
//     }
// 
// 	public Integer connectTimeout() {
// 		return connectTimeout;
// 	}
// 
// 	public OioHttpSettings connectTimeout(Integer connectTimeout) {
// 		this.connectTimeout = connectTimeout;
// 		return this;
// 	}
// 
// 	public Integer readTimeout() {
// 		return readTimeout;
// 	}
// 
// 	public OioHttpSettings readTimeout(Integer readTimeout) {
// 		this.readTimeout = readTimeout;
// 		return this;
// 	}
// 
//     public String userAgent() {
//         return userAgent;
//     }
// 
//     public OioHttpSettings userAgent(String userAgent) {
//         this.userAgent = userAgent;
//         return this;
//     }
// }
// 
// Path: src/main/java/io/openio/sds/common/Check.java
// public static void checkArgument(boolean condition, String msg) {
//     if (!condition)
//         throw new IllegalArgumentException(msg);
// }


// Path: src/main/java/io/openio/sds/common/AbstractSocketProvider.java
import static java.lang.String.format;
import io.openio.sds.exceptions.OioException;
import io.openio.sds.http.OioHttpSettings;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import static io.openio.sds.common.Check.checkArgument;

package io.openio.sds.common;



/**
 *
 * @author Florent Vennetier
 *
 */
public abstract class AbstractSocketProvider implements SocketProvider {

    /**
     * Configure an already created Socket with provided settings, and establish the connection.
     *
     * @param sock A Socket instance
     * @param target The address to connect the socket to
     * @param http The settings to apply
     * @throws OioException if an error occurs during connection
     */
    protected void configureAndConnect(Socket sock, InetSocketAddress target, OioHttpSettings http)
            throws OioException {