httpservices/src/main/java/ucar/httpservices/HTTPFactory.java
static protected HTTPMethod makemethod(HTTPSession.Methods m, HTTPSession session, String url)
            throws HTTPException
    {
        HTTPMethod meth = null;
        if(MOCKMETHODCLASS == null) { // do the normal case
            meth = new HTTPMethod(m, session, url);
        } else {//(MOCKMETHODCLASS != null)
            java.lang.Class methodcl = MOCKMETHODCLASS;
            Constructor<HTTPMethod> cons = null;
            try {
                cons = methodcl.getConstructor(HTTPSession.Methods.class, HTTPSession.class, String.class);
            } catch (Exception e) {
                throw new HTTPException("HTTPFactory: no proper HTTPMethod constructor available", e);
            }
            try {
                meth = cons.newInstance(m, session, url);
            } catch (Exception e) {
                throw new HTTPException("HTTPFactory: HTTPMethod constructor failed", e);
            }
        }
        return meth;
    }
static protected HTTPMethod makemethod(HTTPSession.Methods m, HTTPSession session, String url)
            throws HTTPException
    {
        HTTPMethod meth = null;
        if(MOCKMETHODCLASS == null) { // do the normal case
            meth = new HTTPMethod(m, session, url);
        } else {//(MOCKMETHODCLASS != null)
            java.lang.Class methodcl = MOCKMETHODCLASS;
            Constructor<HTTPMethod> cons = null;
            try {
                cons = methodcl.getConstructor(HTTPSession.Methods.class, HTTPSession.class, String.class);
            } catch (Exception e) {
                throw new HTTPException("HTTPFactory: no proper HTTPMethod constructor available", e);
            }
            try {
                meth = cons.newInstance(m, session, url);
            } catch (Exception e) {
                throw new HTTPException("HTTPFactory: HTTPMethod constructor failed", e);
            }
        }
        return meth;
    }
static protected HTTPMethod makemethod ( HTTPSession . Methods m , HTTPSession session , String url ) throws HTTPException { HTTPMethod meth = null ; if ( MOCKMETHODCLASS == null ) { // do the normal case meth = new HTTPMethod ( m , session , url ) ; } else { //(MOCKMETHODCLASS != null) java . lang . Class methodcl = MOCKMETHODCLASS ; Constructor < HTTPMethod > cons = null ; try { cons = methodcl . getConstructor ( HTTPSession . Methods . class , HTTPSession . class , String . class ) ; } catch ( Exception e ) { throw new HTTPException ( "HTTPFactory: no proper HTTPMethod constructor available" , e ) ; } try { meth = cons . newInstance ( m , session , url ) ; } catch ( Exception e ) { throw new HTTPException ( "HTTPFactory: HTTPMethod constructor failed" , e ) ; } } return meth ; }
Common method creation code so we can isolate mocking

@param session
@return
@throws HTTPException
Common method creation code so we can isolate mocking