| Constructor and Description |
|---|
SocketUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
validResponse(String request,
String responsePattern,
BufferedReader r,
Writer wr)
Writes
request to wr then reads the response from r and validates that it matches the pattern provided in responsePattern. |
static Socket |
wrapSocketInSslContext(Socket socket) |
static SSLSocket |
wrapSocketInSslContext(Socket socket,
String protocol) |
static SSLSocket |
wrapSocketInSslContext(Socket socket,
String protocol,
String[] cipherSuites) |
public static Socket wrapSocketInSslContext(Socket socket) throws IOException
IOExceptionpublic static SSLSocket wrapSocketInSslContext(Socket socket, String protocol) throws IOException
IOExceptionpublic static SSLSocket wrapSocketInSslContext(Socket socket, String protocol, String[] cipherSuites) throws IOException
IOExceptionpublic static boolean validResponse(String request, String responsePattern, BufferedReader r, Writer wr) throws IOException
Writes request to wr then reads the response from r and validates that it matches the pattern provided in responsePattern.
To obtain r from a java.util.Socket socket:
new BufferedReader(new InputStreamReader(socket.getInputStream()));
To obtain wr from a java.util.Socket socket:
new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
request - the String to write to wrresponsePattern - a String representing a regular expression pattern you expect to match the response received from r after writing request to wrr - the BufferedReader from which to get the responsewr - the Writer on which the request is writtenIOExceptionCopyright © 2022. All rights reserved.