OK, I think I've figured this all out. There are in fact two, yes two, 
bugs in JSS here.

 > 1. I create a server socket to listen on port 9001.
 >

> 2. I then check the local port used by this server socket (via the
> getLocalPort method) and I get a different port number, value is 1050.
>    (This in itself was unexpected. Shouldn't getLocalPort return the same
> port I create the server socket with??)


It should return 9001. I think the reason it doesn't is
http://bugzilla.mozilla.org/show_bug.cgi?id=115778 . getLocalPort() 
isn't implemented for SSLServerSocket, so it reverts to the 
implementation in java.net.ServerSocket (its parent class), which is 
inappropriate.


> 3. I then accept a client connection, and then check the local port used by
> the new socket on server side (again via the getLocalPort method), and it's
> very much a different port number, value is 10531...


This one is more fun. 10531 in hex is 0x2923. 9001 in hex is 0x2329. I 
forgot to convert from network to host byte order. The method is broken 
on little endian architectures.
http://bugzilla.mozilla.org/show_bug.cgi?id=115779


Both of these bugs are easy to fix for the next version of JSS. They 
don't appear to be very important for what you're doing, because in all 
cases the local port is what you set it to be, 9001. It would be a 
problem if you were telling the server to pick a random port, but that 
is unusual.


Reply via email to