### Question:
Handler extends URLStreamHandler { @Nullable @Override protected URLConnection openConnection(@Nullable final URL url) throws IOException { final URLStreamHandlerFactory handlerFactory = FACTORY.get(); final String protocol = (url != null) ? url.getProtocol() : null; if (handlerFactory != null && protocol != null && protocol.equals("hadoop")) { final String file = url.getFile(); final URLStreamHandler handler = handlerFactory.createURLStreamHandler(URI.create(file).getScheme()); return (handler != null) ? new URL(null, file, handler).openConnection() : null; } else { return null; } }  static void register(); static void setConfiguration(@Nonnull final Configuration conf);  }### Answer:
@Test public void openConnection() throws IOException { final Handler handler = new Handler(); Assert.assertNull("Expected null connection from missing configuration", handler.openConnection(new URL("hadoop:file:/path/file.ext"))); Handler.setConfiguration(new Configuration(false)); Assert.assertNull("Expected null connection from null url", handler.openConnection(null)); Assert.assertNull("Expected null connection from file url", handler.openConnection(new URL("file:/path/file.ext"))); Assert.assertNotNull("Expected non-null connection from hadoop url", handler.openConnection(new URL("hadoop:file:/path/file.ext"))); }