public static Object readObject ( final int port ) throws IOException , ClassNotFoundException { ServerSocket serverSocket = null ; Socket clientSocket = null ; Object objectToReturn = null ; try { serverSocket = new ServerSocket ( port ) ; clientSocket = serverSocket . accept ( ) ; objectToReturn = readObject ( clientSocket ) ; } catch ( final IOException e ) { throw e ; } catch ( final ClassNotFoundException e ) { throw e ; } finally { closeServerSocket ( serverSocket ) ; } return objectToReturn ; }
Reads an object from the given port .