title: How to resolve MetadataAPI giving 'System.CalloutException: IO Exception: Read timed out' error on setting recordType to lookupfield value
body: <p>I am using metadata API to add picklist value('custom') in a field.I have a record type (AAM_T) created which has to be associated with value I have added to picklist, but as on running :
  service.updateMetadata( new MetadataService.Metadata[] { recordType });
  causing an error 'System.CalloutException: IO Exception: Read timed out'.</p>
  
  <pre><code>MetadataService.PickListValue objPickListValue = new MetadataService.PickListValue();
  objPickListValue.fullName = 'custom';
  objPickListValue.default_x = false;
  
  MetadataService.RecordType recordType = (MetadataService.RecordType) 
                                          service.readMetadata('RecordType',
                                          new String[] { 'Account.AAM_T'}).getRecords()[0];
  
  MetadataService.RecordTypePicklistValue[] recordPickListType =  recordType.picklistValues;
  
  if(recordPickListType.size() &gt; 0){
     for(MetadataService.RecordTypePicklistValue rpk : recordPickListType) {
         if(rpk.picklist == picklistToUpdate){
              rpk.values.add(objPickListValue);
              break;
         }
      }
  
      try{
           service.updateMetadata( new MetadataService.Metadata[] { recordType });
         } catch(Exception ex){
            system.debug('@@@getStackTraceString : '+ex.getStackTraceString());
            //Result: System.CalloutException: IO Exception: Read timed out -- null
            system.debug('@@@getMessage : '+ex.getTypeName() 
                         + ': ' + ex.getMessage() + ' -- ' + ex.getCause());
  
          }
  
    }
  </code></pre>