package state;
public class TCPConnection {
TCPState state;
public TCPConnection() {
state = TCPClosed.Instance();
}
public void ActiveOpen() {
state.ActiveOpen(this);
}
public void PassiveOpen() {
state.PassiveOpen(this);
}
public void Close() {
state.Close(this);
}
public void Send() {
state.Send(this);
}
public void Acknowledge() {
state.Acknowledge(this);
}
public void Synchronize() {
state.Synchronize(this);
}
public void ProcessOctet(TCPOctetStream octStream) {
/* Обработка двоичного потока
* ...
*/
}
void ChangeState(TCPState state) {
this.state = state;
}
}