Where to disable nagle algorithm?

I call setTCPNoDelay(true) right after creating the socket but it still buffers packets.

Exactly where do I need to call it?

Are you using a BufferedOutputStream or something? If so, remember to call flush().