Program: 154346
Project: 154346
Buggy source:
private void serverHandshake() throws AlertException {
switch (type) {
case CLIENT_HELLO:
    state.addHandshakeLog("String_Node_Str");
  if (lastMessage != HELLO_REQUEST)   throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str" + lastMessage);
serverRandom=new byte[RANDOM_SIZE];
genRandom(serverRandom);
clientHello=new ClientHello(content);
serverHello=new ServerHello(clientHello,serverRandom);
responseQueue.add(serverHello);
serverCertificate=new ServerCertificate("String_Node_Str",serverHello);
responseQueue.add(serverCertificate);
if (serverHello.getChosenCipherSuite().getKeyExchange().requireServerKeyExchange()) {
serverKeyExchange=new ServerKeyExchange(serverHello);
responseQueue.add(serverKeyExchange);
}
serverHelloDone=new ServerHelloDone();
responseQueue.add(serverHelloDone);
break;
case CERTIFICATE_VERIFY:
state.addHandshakeLog("String_Node_Str");
throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str");
case CLIENT_KEY_EXCHANGE:
state.addHandshakeLog("String_Node_Str");
if (lastMessage != SERVER_HELLO_DONE) throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str" + lastMessage);
break;
case CHANGE_CIPHER_SPEC:
state.addHandshakeLog("String_Node_Str");
state.setChangeCipherSpecClient();
state.setCipherSuite(serverHello.getChosenCipherSuite());
break;
case FINISHED:
state.addHandshakeLog("String_Node_Str");
if (lastMessage != CHANGE_CIPHER_SPEC) throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str" + lastMessage);
if (!state.getChangeCipherSpecClient()) throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str");
responseQueue.add(new ChangeCipherSpec());
state.setChangeCipherSpecServer();
serverFinished=new Finished();
responseQueue.add(serverFinished);
break;
default :
throw new AlertException(AlertException.alert_warning,AlertException.handshake_failure,"String_Node_Str" + type);
}
}

Fixed version (ground truth):
private void serverHandshake() throws AlertException {
switch (type) {
case CLIENT_HELLO:
    state.addHandshakeLog("String_Node_Str");
  if (lastMessage != HELLO_REQUEST && lastMessage != FINISHED)   throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str" + lastMessage);
serverRandom=new byte[RANDOM_SIZE];
genRandom(serverRandom);
clientHello=new ClientHello(content);
serverHello=new ServerHello(clientHello,serverRandom);
responseQueue.add(serverHello);
serverCertificate=new ServerCertificate("String_Node_Str",serverHello);
responseQueue.add(serverCertificate);
if (serverHello.getChosenCipherSuite().getKeyExchange().requireServerKeyExchange()) {
serverKeyExchange=new ServerKeyExchange(serverHello);
responseQueue.add(serverKeyExchange);
}
serverHelloDone=new ServerHelloDone();
responseQueue.add(serverHelloDone);
break;
case CERTIFICATE_VERIFY:
state.addHandshakeLog("String_Node_Str");
throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str");
case CLIENT_KEY_EXCHANGE:
state.addHandshakeLog("String_Node_Str");
if (lastMessage != SERVER_HELLO_DONE) throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str" + lastMessage);
break;
case CHANGE_CIPHER_SPEC:
state.addHandshakeLog("String_Node_Str");
state.setChangeCipherSpecClient();
state.setCipherSuite(serverHello.getChosenCipherSuite());
break;
case FINISHED:
state.addHandshakeLog("String_Node_Str");
if (lastMessage != CHANGE_CIPHER_SPEC) throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str" + lastMessage);
if (!state.getChangeCipherSpecClient()) throw new AlertException(AlertException.alert_fatal,AlertException.handshake_failure,"String_Node_Str");
responseQueue.add(new ChangeCipherSpec());
state.setChangeCipherSpecServer();
serverFinished=new Finished();
responseQueue.add(serverFinished);
break;
default :
throw new AlertException(AlertException.alert_warning,AlertException.handshake_failure,"String_Node_Str" + type);
}
}