finish("From greet()");
}
addTimeout();
SystemInfo info = MainHandler.getCurrentInstance().getInfo();
ourAddress.addAll(info.getAddressList());
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, "SYS "
+ info.getStationName()));
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, "ZYZ "
+ info.getSysop()));
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, "LOC "
+ info.getLocation()));
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, "NDL "
+ info.getNDL()));
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, "VER "
+ MainHandler.getVersion() + " binkp/1.1"));
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, "TIME "
+ format.format(new Date())));
connectionState = STATE_ADDR;
if (clientConnection) {
sendAddrs();
} else {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
md.update(String.format("%d%d", System.currentTimeMillis(),
System.nanoTime()).getBytes());
byte[] digest = md.digest();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 16; i++) {
builder.append(String.format("%02x", digest[i]));
}
cramText = builder.toString();
cramAlgo = "MD5";
frames.addLast(new BinkpFrame(BinkpCommand.M_NUL, String
.format("OPT CRAM-MD5-%s", cramText)));
} catch (NoSuchAlgorithmException e) {
cramText = null;
}