public ClientServerConnection(Gateway gateway, Socket socket, List<Class<? extends Command>> customCommands,
Py4JPythonClientPerThread pythonClient, Py4JJavaServer javaServer, int readTimeout, String authToken)
throws IOException {
super();
this.socket = socket;
this.reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), Charset.forName("UTF-8")));
this.writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), Charset.forName("UTF-8")));
this.commands = new HashMap<String, Command>();
initCommands(gateway, GatewayConnection.getBaseCommands());
if (customCommands != null) {
initCommands(gateway, customCommands);
}
this.javaServer = javaServer;
this.pythonClient = pythonClient;
this.blockingReadTimeout = readTimeout;
if (readTimeout > 0) {
this.nonBlockingReadTimeout = readTimeout;
} else {
this.nonBlockingReadTimeout = CallbackConnection.DEFAULT_NONBLOCKING_SO_TIMEOUT;
}
this.authToken = authToken;
if (authToken != null) {
this.authCommand = new AuthCommand(authToken);
initCommand(gateway, authCommand);
} else {
this.authCommand = null;
}
}