Fixed error in server and cleaned java client

Server was not returning full buffer length due to mistype in one of the
fields.