package be.nikiroo.utils.serial.server;
-import java.io.IOException;
import java.net.Socket;
-import javax.net.ssl.SSLException;
-
import be.nikiroo.utils.Version;
/**
action = new ConnectAction(s, true, key, serverVersion) {
@Override
protected void action(Version clientVersion) throws Exception {
- ConnectActionServer.this.serverHello();
ConnectActionServer.this.action(clientVersion);
}
};
}
- /**
- * Send the HELLO message (check that the client sends a String "HELLO" and
- * send it back, to check I/O and encryption modes).
- *
- * @throws IOException
- * in case of I/O error
- * @throws SSLException
- * in case of encryption error
- */
- protected void serverHello() throws IOException, SSLException {
- String HELLO = action.recString();
- if (!"HELLO".equals(HELLO)) {
- throw new SSLException("Server did not accept the encryption key");
- }
- action.sendString(HELLO);
- }
-
/**
* Actually start the process and call the action (synchronous).
*/