X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2Fserver%2FConnectActionClient.java;h=31b71b92af80eb8383fba1099e548fff5a4cd750;hb=a0eb51f41b98280d751d13d15489a6e375fe8b80;hp=db06a9f247544cef1d210531d7db45429af1a78b;hpb=f4053377fa15da2f11e82955bfab86e673fa371c;p=fanfix.git diff --git a/src/be/nikiroo/utils/serial/server/ConnectActionClient.java b/src/be/nikiroo/utils/serial/server/ConnectActionClient.java index db06a9f..31b71b9 100644 --- a/src/be/nikiroo/utils/serial/server/ConnectActionClient.java +++ b/src/be/nikiroo/utils/serial/server/ConnectActionClient.java @@ -4,8 +4,6 @@ import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; -import be.nikiroo.utils.Version; - /** * Base class used for the client basic handling. *

@@ -22,41 +20,6 @@ abstract class ConnectActionClient { */ protected ConnectAction action; - /** - * Create a new {@link ConnectActionClient} with the current application - * version (see {@link Version#getCurrentVersion()}) as the client version. - * - * @param s - * the socket to bind to - */ - public ConnectActionClient(Socket s) { - this(s, Version.getCurrentVersion()); - } - - /** - * Create a new {@link ConnectActionClient} with the current application - * version (see {@link Version#getCurrentVersion()}) as the client version. - * - * @param host - * the host to bind to - * @param port - * the port to bind to - * @param ssl - * TRUE for an SSL connection, FALSE for plain text - * - * @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 - */ - public ConnectActionClient(String host, int port, boolean ssl) - throws IOException { - this(Server.createSocket(host, port, ssl), Version.getCurrentVersion()); - } - /** * Create a new {@link ConnectActionClient}. * @@ -64,10 +27,9 @@ abstract class ConnectActionClient { * the host to bind to * @param port * the port to bind to - * @param ssl - * TRUE for an SSL connection, FALSE for plain text - * @param version - * the client version + * @param key + * an optional key to encrypt all the communications (if NULL, + * everything will be sent in clear text) * * @throws IOException * in case of I/O error @@ -77,9 +39,9 @@ abstract class ConnectActionClient { * 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, - Version version) throws IOException { - this(Server.createSocket(host, port, ssl), version); + public ConnectActionClient(String host, int port, String key) + throws IOException { + this(new Socket(host, port), key); } /** @@ -87,27 +49,21 @@ abstract class ConnectActionClient { * * @param s * the socket to bind to - * @param version - * the client version + * @param key + * an optional key to encrypt all the communications (if NULL, + * everything will be sent in clear text) */ - public ConnectActionClient(Socket s, Version version) { - action = new ConnectAction(s, false, version) { + public ConnectActionClient(Socket s, String key) { + action = new ConnectAction(s, false, key) { @Override - protected void action(Version serverVersion) throws Exception { - ConnectActionClient.this.action(serverVersion); + protected void action() throws Exception { + ConnectActionClient.this.action(); } @Override protected void onError(Exception e) { ConnectActionClient.this.onError(e); } - - @Override - protected Version negotiateVersion(Version clientVersion) { - new Exception("Should never be called on a client") - .printStackTrace(); - return null; - } }; } @@ -133,14 +89,11 @@ abstract class ConnectActionClient { /** * Method that will be called when an action is performed on the client. * - * @param serverVersion - * the server version - * * @throws Exception * in case of I/O error */ @SuppressWarnings("unused") - public void action(Version serverVersion) throws Exception { + public void action() throws Exception { } /**