// do transmission in an authenticated and encrypted context
remoteResult = transmission.doRemote(client);
// mark end of transaction
final End endPacket = new End();
client.send(endPacket);
// wait for server to close connection here..
client.waitForClose(2000);
client.close();