Package eu.tneitzel.rmg.networking
Class TimeoutSocketFactory
- java.lang.Object
-
- java.rmi.server.RMISocketFactory
-
- eu.tneitzel.rmg.networking.TimeoutSocketFactory
-
- All Implemented Interfaces:
RMIClientSocketFactory,RMIServerSocketFactory
public class TimeoutSocketFactory extends RMISocketFactory
The TimeoutSocketFactory is a wrapper around the default RMISocketFactory that allows to set timeouts for the created sockets. This is required because RMI sockets have large default values for connect or read timeouts. During remote-method-guesser's scan operation, this is not desired.- Author:
- Tobias Neitzel (@qtc_de)
-
-
Constructor Summary
Constructors Constructor Description TimeoutSocketFactory(int readTimeout, int connectTimeout)Create a new factory using the specified read and connect timeout for TCP sockets.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerSocketcreateServerSocket(int port)Never used by remote-method-guesser but required to implement the interface.SocketcreateSocket(String host, int port)Creates a socket by using the default factory and sets the read timeout on it.-
Methods inherited from class java.rmi.server.RMISocketFactory
getDefaultSocketFactory, getFailureHandler, getSocketFactory, setFailureHandler, setSocketFactory
-
-
-
-
Constructor Detail
-
TimeoutSocketFactory
public TimeoutSocketFactory(int readTimeout, int connectTimeout)Create a new factory using the specified read and connect timeout for TCP sockets.- Parameters:
readTimeout- timeout for read operations on the socketconnectTimeout- timeout for the initial socket connect
-
-
Method Detail
-
createServerSocket
public ServerSocket createServerSocket(int port) throws IOException
Never used by remote-method-guesser but required to implement the interface. Just hand over to the default factory.- Specified by:
createServerSocketin interfaceRMIServerSocketFactory- Specified by:
createServerSocketin classRMISocketFactory- Throws:
IOException
-
createSocket
public Socket createSocket(String host, int port) throws IOException
Creates a socket by using the default factory and sets the read timeout on it. Then the socket is connected to the target using the specified connect timeout.- Specified by:
createSocketin interfaceRMIClientSocketFactory- Specified by:
createSocketin classRMISocketFactory- Throws:
IOException
-
-