- * @param host
- * the host to connect to
- * @param port
- * the port to connect to
- * @param ssl
- * TRUE for SSL mode (or FALSE for plain text mode)
- *
- * @return the {@link Socket}
- *
- * @throws IOException
- * in case of I/O error
- * @throws UnknownHostException
- * if the host is not known
- * @throws IllegalArgumentException
- * if the port parameter is outside the specified range of valid
- * port values, which is between 0 and 65535, inclusive
- */
- static Socket createSocket(String host, int port, boolean ssl)
- throws IOException {
- Socket s;
- if (ssl) {
- s = SSLSocketFactory.getDefault().createSocket(host, port);
- if (s instanceof SSLSocket) {
- // Should always be the case
- ((SSLSocket) s).setEnabledCipherSuites(ANON_CIPHERS);
- }
- } else {
- s = new Socket(host, port);
- }
-
- return s;
- }
-
- /**
- * Create a {@link ServerSocket}.
- *
- * @param port
- * the port to accept connections on
- * @param ssl
- * TRUE for SSL mode (or FALSE for plain text mode)
- *
- * @return the {@link ServerSocket}
- *
- * @throws IOException
- * in case of I/O error
- * @throws UnknownHostException
- * if the IP address of the host could not be determined
- * @throws IllegalArgumentException
- * if the port parameter is outside the specified range of valid
- * port values, which is between 0 and 65535, inclusive