Hypothesis test for correlation between Gamma random variables I have two Gamma random variables. I need a hypothesis test to detect a possible correlation between them.
 A: For non-normal data, the traditional hypothesis test of the Pearson correlation can result in slightly inflated Type I error rates and much lower power, at least relative to alternative hypothesis tests.  In a Monte Carlo study, Bishara and Hittner (2012) compared several alternative hypothesis tests for non-normal data.  The permutation test generally preserved the Type I error rate at the nominal alpha level, but was underpowered when n >= 20.  For sample sizes of at least 20, the most effective approach was data transformation to approximate normality prior to the traditional t-test of the Pearson correlation.  
In your case, if you know the parameters of your population gamma distributions, then you can transform your samples appropriately.  If not, you can use a Rank-based Inverse Normal transformation, such as rankit, as an approximation.  After transforming the data, simply do a hypothesis test of the Pearson correlation as usual.
References: 
Bishara, A. J., & Hittner, J. B. (2012). Testing the significance of a correlation with non-normal data: Comparison of Pearson, Spearman, transformation, and resampling approaches. Psychological Methods, 17, 399-417. doi:10.1037/a0028087
A: You can use the regular, old Pearson's product-moment correlation for this.  The fact that your data are distributed as Gamma doesn't matter (cf.: Pearson's or Spearman's correlation with non-normal data).  Most statistical software that can compute $r$ for you can provide you with a test.  By default, such tests assess the null hypothesis that $r=0$; thus, a significant result suggests (detects) a correlation.  Should you need to do it by hand, formulas are listed on the Wikipedia page; using Fisher's transform is convenient and popular.  Here is a quick demo in R:
set.seed(8864)             # this makes the example exactly reproducible
g1u = rgamma(50, shape=5)  # these variables are distributed as Gamma
g2u = rgamma(50, shape=8)  # they are uncorrelated
cor.test(g1u, g2u)
# 
#         Pearson's product-moment correlation
# 
# data:  g1u and g2u
# t = 0.3079, df = 48, p-value = 0.7595
# alternative hypothesis: true correlation is not equal to 0
# 95 percent confidence interval:
#  -0.2368827  0.3188006
# sample estimates:
#        cor 
# 0.04439207
g1c = sort(g1u)
g2c = sort(g2u)  # now they are correlated
cor.test(g1c, g2c)
# 
#         Pearson's product-moment correlation
# 
# data:  g1c and g2c
# t = 28.9317, df = 48, p-value < 2.2e-16
# alternative hypothesis: true correlation is not equal to 0
# 95 percent confidence interval:
#  0.9518055 0.9843849
# sample estimates:
#       cor 
# 0.9725047

Using the test of the correlation detected (suggested, really—it can certainly be wrong, but that's the nature of any hypothesis test) when the variables were correlated.  The fact that the variables were distributed as Gamma had no noticeable effect.  
A: You can use distance correlation by Szekely. R Package is called 'energy'. It is distribution agnostic and gamma doesn't matter. You can get a p-value of the test as well.
