receiving messages in java