001package ca.uhn.hl7v2.util;
002
003import java.io.IOException;
004import java.net.ServerSocket;
005import java.net.Socket;
006import java.net.SocketException;
007
008/**
009 * Pluggable socket factory interface
010 */
011public interface SocketFactory {
012
013        /**
014         * Create a standard client socket
015         */
016        Socket createSocket() throws IOException;
017        
018        /**
019         * Create a TLS client socket
020         */
021        Socket createTlsSocket() throws IOException;
022        
023        /**
024         * Create a standard server socket
025         */     
026        ServerSocket createServerSocket() throws IOException;
027        
028        /**
029         * Create a TLS server socket
030         */
031        ServerSocket createTlsServerSocket() throws IOException;
032
033        /**
034         * Invoked by server processes each time a new server is {@link ServerSocket#accept() accepted}
035         * in order to set configuration settings on the new socket
036         */
037        void configureNewAcceptedSocket(Socket theSocket) throws SocketException;
038        
039}