// Path: core/src/main/java/net/javacrumbs/mocksocket/MockSocketException.java
// public class MockSocketException extends RuntimeException {
// 	private static final long serialVersionUID = -6476984055059688027L;
// 
// 	public MockSocketException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public MockSocketException(String message) {
// 		super(message);
// 	}
// 
// 	public MockSocketException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 
// }
// 
// Path: core/src/main/java/net/javacrumbs/mocksocket/socket/MockSocketImplFactory.java
// public class MockSocketImplFactory implements SocketImplFactory {
// 	private final ConnectionFactory connectionFactory;
// 	
// 	public MockSocketImplFactory(ConnectionFactory connectionFactory) {
// 		this.connectionFactory = connectionFactory;
// 	}
// 
// 	public SocketImpl createSocketImpl() {
// 		return new ConnectionFactoryMockSocketImpl(connectionFactory);
// 	}
// 
// }


import java.io.IOException;
import java.net.Socket;
import java.net.SocketImplFactory;
import net.javacrumbs.mocksocket.MockSocketException;
import net.javacrumbs.mocksocket.socket.MockSocketImplFactory;
			UniversalMockConnectionFactory mockConnection = new UniversalMockConnectionFactory();
			useConnectionFactory(mockConnection);
			return mockConnection;
		}
		else
		{
			throw new IllegalArgumentException("Can not call expectCall twice. You have to call reset before each test. If you need simulate multiple requests, please call andReturn several times.");
		}
	}
	
	public synchronized static void reset()
	{
		connectionFactory = null;
	}


	public static void useConnectionFactory(ConnectionFactory connectionFactory) {
		StaticConnectionFactory.connectionFactory = connectionFactory;
	}
	
	protected synchronized static ConnectionFactory getConnectionFactory() {
		return connectionFactory;
	}
	public synchronized static RequestRecorder getRequestRecorder() {
		if (connectionFactory instanceof RequestRecorder)
		{
			return (RequestRecorder)connectionFactory;
		}
		else if (connectionFactory!=null)
		{
// Path: core/src/main/java/net/javacrumbs/mocksocket/MockSocketException.java
// public class MockSocketException extends RuntimeException {
// 	private static final long serialVersionUID = -6476984055059688027L;
// 
// 	public MockSocketException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public MockSocketException(String message) {
// 		super(message);
// 	}
// 
// 	public MockSocketException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 
// }
// 
// Path: core/src/main/java/net/javacrumbs/mocksocket/socket/MockSocketImplFactory.java
// public class MockSocketImplFactory implements SocketImplFactory {
// 	private final ConnectionFactory connectionFactory;
// 	
// 	public MockSocketImplFactory(ConnectionFactory connectionFactory) {
// 		this.connectionFactory = connectionFactory;
// 	}
// 
// 	public SocketImpl createSocketImpl() {
// 		return new ConnectionFactoryMockSocketImpl(connectionFactory);
// 	}
// 
// }


// Path: core/src/main/java/net/javacrumbs/mocksocket/connection/StaticConnectionFactory.java
import java.io.IOException;
import java.net.Socket;
import java.net.SocketImplFactory;
import net.javacrumbs.mocksocket.MockSocketException;
import net.javacrumbs.mocksocket.socket.MockSocketImplFactory;

			UniversalMockConnectionFactory mockConnection = new UniversalMockConnectionFactory();
			useConnectionFactory(mockConnection);
			return mockConnection;
		}
		else
		{
			throw new IllegalArgumentException("Can not call expectCall twice. You have to call reset before each test. If you need simulate multiple requests, please call andReturn several times.");
		}
	}
	
	public synchronized static void reset()
	{
		connectionFactory = null;
	}


	public static void useConnectionFactory(ConnectionFactory connectionFactory) {
		StaticConnectionFactory.connectionFactory = connectionFactory;
	}
	
	protected synchronized static ConnectionFactory getConnectionFactory() {
		return connectionFactory;
	}
	public synchronized static RequestRecorder getRequestRecorder() {
		if (connectionFactory instanceof RequestRecorder)
		{
			return (RequestRecorder)connectionFactory;
		}
		else if (connectionFactory!=null)
		{
			throw new MockSocketException("Connection factory "+connectionFactory.getClass()+" is not instance of "+RequestRecorder.class);