@Override
    public SharedResourceRunner.Resource createSharedResource(String connection) {
      final X11GraphicsDevice sharedDevice =
          new X11GraphicsDevice(
              X11Util.openDisplay(connection),
              AbstractGraphicsDevice.DEFAULT_UNIT,
              true /* owner */);
      sharedDevice.lock();
      try {
        final X11GraphicsScreen sharedScreen =
            new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen());

        GLXUtil.initGLXClientDataSingleton(sharedDevice);
        final String glXServerVendorName =
            GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR);
        final boolean glXServerMultisampleAvailable =
            GLXUtil.isMultisampleAvailable(
                GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS));

        final GLProfile glp =
            GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
        if (null == glp) {
          throw new GLException("Couldn't get default GLProfile for device: " + sharedDevice);
        }

        final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
        final GLDrawableImpl sharedDrawable =
            createOnscreenDrawableImpl(
                createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
        sharedDrawable.setRealized(true);
        final X11GLCapabilities chosenCaps =
            (X11GLCapabilities) sharedDrawable.getChosenGLCapabilities();
        final boolean glxForcedOneOne = !chosenCaps.hasFBConfig();
        final VersionNumber glXServerVersion;
        if (glxForcedOneOne) {
          glXServerVersion = versionOneOne;
        } else {
          glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice);
        }
        final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null);
        if (null == sharedContext) {
          throw new GLException("Couldn't create shared context for drawable: " + sharedDrawable);
        }

        boolean madeCurrent = false;
        sharedContext.makeCurrent();
        try {
          madeCurrent = sharedContext.isCurrent();
        } finally {
          sharedContext.release();
        }
        if (sharedContext.hasRendererQuirk(GLRendererQuirks.DontCloseX11Display)) {
          X11Util.markAllDisplaysUnclosable();
        }
        if (DEBUG) {
          System.err.println("SharedDevice:  " + sharedDevice);
          System.err.println("SharedScreen:  " + sharedScreen);
          System.err.println("SharedContext: " + sharedContext + ", madeCurrent " + madeCurrent);
          System.err.println("GLX Server Vendor:      " + glXServerVendorName);
          System.err.println(
              "GLX Server Version:     " + glXServerVersion + ", forced " + glxForcedOneOne);
          System.err.println("GLX Server Multisample: " + glXServerMultisampleAvailable);
          System.err.println("GLX Client Vendor:      " + GLXUtil.getClientVendorName());
          System.err.println("GLX Client Version:     " + GLXUtil.getClientVersionNumber());
          System.err.println("GLX Client Multisample: " + GLXUtil.isClientMultisampleAvailable());
        }
        return new SharedResource(
            sharedDevice,
            sharedScreen,
            sharedDrawable,
            sharedContext,
            glXServerVersion,
            glXServerVendorName,
            glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable());
      } catch (Throwable t) {
        throw new GLException(
            "X11GLXDrawableFactory - Could not initialize shared resources for " + connection, t);
      } finally {
        sharedDevice.unlock();
      }
    }