Using Java.net Socket

You should not be iterating through all of the methods. Simply request the correct method with .getMethod(java.lang.String,java.lang.Class...). It takes the string name of the method and additional parameters matching the data types of the desired overload. Get the type() of an empty jarray of bytes to get byte[] to supply to the function.