TCP engine in java