You need to create the
ObjectOutputStream
before the
ObjectInputStream
at both sides of the connection(!). When the
ObjectInputStream
is created, it tries to read the object stream header from the
InputStream
. So if the
ObjectOutputStream
on the other side hasn't been created yet there is no object stream header to read, and it will block indefinitely.