git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
serial: switch from SSL to CryptUtils
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
utils
/
serial
/
server
/
ConnectActionClient.java
diff --git
a/src/be/nikiroo/utils/serial/server/ConnectActionClient.java
b/src/be/nikiroo/utils/serial/server/ConnectActionClient.java
index 626b62f78494ab4fdb818220629a281bc3507f14..c56dddd0a727b869f58cec1ce37f6a23c2d2be0f 100644
(file)
--- a/
src/be/nikiroo/utils/serial/server/ConnectActionClient.java
+++ b/
src/be/nikiroo/utils/serial/server/ConnectActionClient.java
@@
-2,6
+2,7
@@
package be.nikiroo.utils.serial.server;
import java.io.IOException;
import java.net.Socket;
import java.io.IOException;
import java.net.Socket;
+import java.net.UnknownHostException;
import be.nikiroo.utils.Version;
import be.nikiroo.utils.Version;
@@
-27,9
+28,12
@@
abstract class ConnectActionClient {
*
* @param s
* the socket to bind to
*
* @param s
* the socket to bind to
+ * @param key
+ * an optional key to encrypt all the communications (if NULL,
+ * everything will be sent in clear text)
*/
*/
- public ConnectActionClient(Socket s) {
- this(s, Version.getCurrentVersion());
+ public ConnectActionClient(Socket s
, String key
) {
+ this(s,
key,
Version.getCurrentVersion());
}
/**
}
/**
@@
-40,15
+44,21
@@
abstract class ConnectActionClient {
* the host to bind to
* @param port
* the port to bind to
* the host to bind to
* @param port
* the port to bind to
- * @param ssl
- * TRUE for an SSL connection, FALSE for plain text
+ * @param key
+ * an optional key to encrypt all the communications (if NULL,
+ * everything will be sent in clear text)
*
* @throws IOException
*
* @throws IOException
- * in case of I/O error when creating the socket
+ * 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
*/
*/
- public ConnectActionClient(String host, int port,
boolean ssl
)
+ public ConnectActionClient(String host, int port,
String key
)
throws IOException {
throws IOException {
- this(
Server.createSocket(host, port, ssl)
, Version.getCurrentVersion());
+ this(
new Socket(host, port), key
, Version.getCurrentVersion());
}
/**
}
/**
@@
-58,17
+68,23
@@
abstract class ConnectActionClient {
* the host to bind to
* @param port
* the port to bind to
* the host to bind to
* @param port
* the port to bind to
- * @param ssl
- * TRUE for an SSL connection, FALSE for plain text
+ * @param key
+ * an optional key to encrypt all the communications (if NULL,
+ * everything will be sent in clear text)
* @param version
* the client version
*
* @throws IOException
* @param version
* the client version
*
* @throws IOException
- * in case of I/O error when creating the socket
+ * 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
*/
*/
- public ConnectActionClient(String host, int port,
boolean ssl
,
+ public ConnectActionClient(String host, int port,
String key
,
Version version) throws IOException {
Version version) throws IOException {
- this(
Server.createSocket(host, port, ssl)
, version);
+ this(
new Socket(host, port), key
, version);
}
/**
}
/**
@@
-76,11
+92,14
@@
abstract class ConnectActionClient {
*
* @param s
* the socket to bind to
*
* @param s
* the socket to bind to
+ * @param key
+ * an optional key to encrypt all the communications (if NULL,
+ * everything will be sent in clear text)
* @param version
* the client version
*/
* @param version
* the client version
*/
- public ConnectActionClient(Socket s, Version version) {
- action = new ConnectAction(s, false, version) {
+ public ConnectActionClient(Socket s,
String key,
Version version) {
+ action = new ConnectAction(s, false,
key,
version) {
@Override
protected void action(Version serverVersion) throws Exception {
ConnectActionClient.this.action(serverVersion);
@Override
protected void action(Version serverVersion) throws Exception {
ConnectActionClient.this.action(serverVersion);