title: Programmatically close a jetty client
body: <p>I'm setting-up a <strong>jetty</strong> client that will be used to handle Google's <strong>oauth2</strong> authorization flow</p>
  
  <pre><code>com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver receiver =
                  new LocalServerReceiver.Builder().setHost(redirect_host).setPort(redirect_port).build();
  </code></pre>
  
  <p>This will <strong>fail</strong> if a previous authorization flow failed and <em>left the jetty client open</em>.</p>
  
  <pre><code>INFO [log:131] jetty-6.1.26
  WARN [log:265] failed SocketConnector@180.200.105.100:8085: java.net.BindException: Address already in use
  WARN [log:265] failed Server@32c65328: java.net.BindException: Address already in use
  </code></pre>
  
  <p>Please, note that I'm using a <strong>fixed url and port</strong>.</p>
  
  <p>Is there some way I can <strong>check programmatically</strong> whether or not the jetty client is <strong>already open</strong>, and handle this case, e.g by closing the previous jetty connection?</p>