LoggedDataOutputStream outputStream = new LoggedDataOutputStream(bos);
setOutputStream(outputStream);
BufferedInputStream bis =
new BufferedInputStream(socket.getInputStream(), 32768);
LoggedDataInputStream inputStream = new LoggedDataInputStream(bis);
setInputStream(inputStream);
outputStream.writeBytes(preamble, "US-ASCII");
outputStream.writeBytes(getRepository() + "\n"); //NOI18N
outputStream.writeBytes(userName + "\n"); //NOI18N
outputStream.writeBytes(getEncodedPasswordNotNull() + "\n", "US-ASCII"); //NOI18N
outputStream.writeBytes(postamble, "US-ASCII");
outputStream.flush();
if (Thread.interrupted()) {
reset();
String localMsg = CommandException.getLocalMessage("Client.connectionAborted", null); //NOI18N
throw new CommandAbortedException("Aborted during connecting to the server.", localMsg); // NOI18N
}
// read first 11 bytes only (AUTHENTICATION_SUCCEEDED_RESPONSE\n)
// I observed lock caused by missing '\n' in reponse
// this method then blocks forever
byte rawResponse[] = inputStream.readBytes(AUTHENTICATION_SUCCEEDED_RESPONSE_RAW.length());
String response = new String(rawResponse, "utf8"); // NOI18N
if (Thread.interrupted()) {
reset();
String localMsg = CommandException.getLocalMessage("Client.connectionAborted", null); //NOI18N