question: protected static ModbusResponse readRequest ( int functionCode , int register , int count ) { ModbusTCPTransport transport = null ; ModbusTCPTransaction trans ; try { Socket socket = new Socket ( LOCALHOST , PORT ) ; transport = new ModbusTCPTransport ( socket ) ; ModbusRequest req = null ; switch ( functionCode ) { case Modbus . READ_COILS : req = new ReadCoilsRequest ( register , count ) ; break ; case Modbus . READ_INPUT_DISCRETES : req = new ReadInputDiscretesRequest ( register , count ) ; break ; case Modbus . READ_INPUT_REGISTERS : req = new ReadInputRegistersRequest ( register , count ) ; break ; case Modbus . READ_HOLDING_REGISTERS : req = new ReadMultipleRegistersRequest ( register , count ) ; break ; default : fail ( String . format ( "Request type %d is not supported by the test harness" , functionCode ) ) ; } req . setUnitID ( UNIT_ID ) ; trans = ( ModbusTCPTransaction ) transport . createTransaction ( ) ; trans . setRequest ( req ) ; trans . setReconnecting ( true ) ; trans . execute ( ) ; return trans . getResponse ( ) ; } catch ( Exception e ) { logger . debug ( e . getMessage ( ) ) ; } finally { if ( transport != null ) { try { transport . close ( ) ; } catch ( IOException e ) { logger . error ( e . getMessage ( ) ) ; } } } return null ; }
target:  Executes a read transaction using the function code, register and count