InputStream is = s.getInputStream();
ObjectInputStream ois = new ObjectInputStream(is);
OutputStream os = s.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
int parentJointStateId;
Side destination;
// networking
parentJointStateId = is.read();
destination = (Side) ois.readObject();