I understand that you are trying to use "mcc" with MATLAB R2015b. You noticed that it takes a very long time to execute until the connection is timed out after setting 'MCC_USE_DEPFUN' environment variable. I am assuming that you followed the steps in the MATLAB Answers link below for setting the environment variable.
https://www.mathworks.com/matlabcentral/answers/259763-mcc-problem-on-linux-2015b
I suspect the license file located on a network server might be causing the issue. If MATLAB fails to connect to the remote license file, it results in the connection timeout issue. I suggest you to use a local license file with mcc to verify the same. You can pass the local license file to "mcc" using '-Y' parameter as follows:
>> mcc -m hello.m -Y license.lic
Note that the '-Y' flag works only with the command-line mode.
If the issue persists even after using the local license file or if the local license cannot be used due to restrictions, I suggest you to contact MathWorks Technical Support for further assistance.