protected synchronized Response netCall ( Request request , int timeout ) { Response response = null ; if ( serverCaps != null && serverCaps . isDebugMode ( ) ) { timeout = 0 ; } try { socket . setSoTimeout ( timeout ) ; DataOutputStream requestPacket = new DataOutputStream ( new BufferedOutputStream ( socket . getOutputStream ( ) ) ) ; request . write ( requestPacket , nextSequenceId ( ) ) ; requestPacket . flush ( ) ; DataInputStream responsePacket = new DataInputStream ( new BufferedInputStream ( socket . getInputStream ( ) ) ) ; response = new Response ( responsePacket ) ; if ( response . getSequenceId ( ) != request . getSequenceId ( ) ) { throw new IOException ( "Response is not for current request." ) ; } } catch ( Exception e ) { netFlush ( ) ; throw MiscUtil . toUnchecked ( e ) ; } if ( response . getResponseType ( ) == ResponseType . ERROR ) { throw new RPCException ( response . getData ( ) ) ; } return response ; }
Issues a request to the server returning the response .