Separated Middleware into MiddlewareRMI and MiddlewareTCP