Ed: However, what I get is the expected String data padded on the right with nulls(?) out to the end of the 1024 bytes, instead of to the end of the byte array actually sent.
do you mean that the string is padded with blanks? The constructor you are using, uses the platform default encoding, is that what you want? if not then use a constructor that also takes the charset name. Also, check the length of the byte array you are sending to the constructor. You must only send the bytes that are received and not the complete byte array.