The client and server have no concern over what language each other use at all.
The routing and data transfer is done entirely by IIS on Windows and Apache on Linux.
The java running on the client sends an http data stream, and depending on if the server is Windows or Linux, it gets routed to the appropriate C#, ASP, PHP, Perl or some other CGI routine.
If the server is Windows, then the Java client will be communicating with C# routines.
Thinking about sockets is way too complex.
That is for programming languages.
C# and Java are not programming languages, but scripting languages interpreted at run time.
The actual programs are the sandbox interpreters that execute the C# or Java, and they already are doing all the low level socket programming.
You don't have to do any in C# or Java.