예제 #1
0
 /** Merges {@code settings} into this peer's settings and sends them to the remote peer. */
 public void setSettings(Settings settings) throws IOException {
   synchronized (frameWriter) {
     synchronized (this) {
       if (shutdown) {
         throw new IOException("shutdown");
       }
       okHttpSettings.merge(settings);
       frameWriter.settings(settings);
     }
   }
 }
예제 #2
0
 /**
  * @param sendConnectionPreface true to send connection preface frames. This should always be true
  *     except for in tests that don't check for a connection preface.
  */
 void start(boolean sendConnectionPreface) throws IOException {
   if (sendConnectionPreface) {
     frameWriter.connectionPreface();
     frameWriter.settings(okHttpSettings);
     int windowSize = okHttpSettings.getInitialWindowSize(Settings.DEFAULT_INITIAL_WINDOW_SIZE);
     if (windowSize != Settings.DEFAULT_INITIAL_WINDOW_SIZE) {
       frameWriter.windowUpdate(0, windowSize - Settings.DEFAULT_INITIAL_WINDOW_SIZE);
     }
   }
   new Thread(readerRunnable).start(); // Not a daemon thread.
 }
 /**
  * Sends a connection header if the current variant requires it. This should be called after
  * {@link Builder#build} for all new connections.
  */
 public void sendConnectionHeader() throws IOException {
   frameWriter.connectionHeader();
   frameWriter.settings(okHttpSettings);
 }