Package org.apache.nifi.io.socket
Class SocketUtils
java.lang.Object
org.apache.nifi.io.socket.SocketUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(ServerSocket serverSocket) static voidcloseQuietly(Socket socket) static ServerSocketcreateServerSocket(int port, ServerSocketConfiguration config) Returns aServerSocketfor the given port and configuration.static SocketcreateSocket(InetSocketAddress address, SocketConfiguration config) Returns aSocket(effectively used as a client socket) for the given address and configuration.static booleanReturnstrueif this exception is due to a TLS problem (either directly or because of its cause, if present).
-
Field Details
-
logger
private static final org.slf4j.Logger logger
-
-
Constructor Details
-
SocketUtils
public SocketUtils()
-
-
Method Details
-
createSocket
public static Socket createSocket(InetSocketAddress address, SocketConfiguration config) throws IOException Returns aSocket(effectively used as a client socket) for the given address and configuration.- Parameters:
address- theInetSocketAddressfor the socket (used for hostname and port)config- theSocketConfiguration- Returns:
- the socket (can be configured for SSL)
- Throws:
IOException- if there is a problem creating the socket
-
createServerSocket
public static ServerSocket createServerSocket(int port, ServerSocketConfiguration config) throws IOException, TlsException Returns aServerSocketfor the given port and configuration.- Parameters:
port- the port for the socketconfig- theServerSocketConfiguration- Returns:
- the server socket (can be configured for SSL)
- Throws:
IOException- if there is a problem creating the socketTlsException- if there is a problem creating the socket
-
closeQuietly
-
closeQuietly
-
isTlsError
Returnstrueif this exception is due to a TLS problem (either directly or because of its cause, if present). Traverses the cause chain recursively.- Parameters:
e- the exception to evaluate- Returns:
- true if the direct or indirect cause of this exception was TLS-related
-