code for a p2p tcp connection i wrote in java for another project